Class: Google::Apis::ServicemanagementV1::Service

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
generated/google/apis/servicemanagement_v1/classes.rb,
generated/google/apis/servicemanagement_v1/representations.rb,
generated/google/apis/servicemanagement_v1/representations.rb

Overview

Service is the root object of Google service configuration schema. It describes basic information about a service, such as the name and the title, and delegates other aspects to sub-sections. Each sub-section is either a proto message or a repeated proto message that configures a specific aspect, such as auth. See each proto message definition for details. Example: type: google.api.Service config_version: 3 name: calendar.googleapis.com title: Google Calendar API apis:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Core::JsonObjectSupport

#to_json

Methods included from Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ Service

Returns a new instance of Service



1672
1673
1674
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1672

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#apisArray<Google::Apis::ServicemanagementV1::Api>

A list of API interfaces exported by this service. Only the name field of the google.protobuf.Api needs to be provided by the configuration author, as the remaining fields will be derived from the IDL during the normalization process. It is an error to specify an API interface here which cannot be resolved against the associated IDL files. Corresponds to the JSON property apis



1398
1399
1400
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1398

def apis
  @apis
end

#authenticationGoogle::Apis::ServicemanagementV1::Authentication

Authentication defines the authentication configuration for an API. Example for an API targeted for external use: name: calendar.googleapis.com authentication: providers:



1594
1595
1596
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1594

def authentication
  @authentication
end

#backendGoogle::Apis::ServicemanagementV1::Backend

Backend defines the backend configuration for a service. Corresponds to the JSON property backend



1431
1432
1433
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1431

def backend
  @backend
end

#config_versionFixnum

The version of the service configuration. The config version may influence interpretation of the configuration, for example, to determine defaults. This is documented together with applicable options. The current default for the config version itself is 3. Corresponds to the JSON property configVersion

Returns:

  • (Fixnum)


1615
1616
1617
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1615

def config_version
  @config_version
end

#contextGoogle::Apis::ServicemanagementV1::Context

Context defines which contexts an API requests. Example: context: rules:

  • selector: "*" requested:
  • google.rpc.context.ProjectContext
  • google.rpc.context.OriginContext The above specifies that all methods in the API request google.rpc.context.ProjectContext and google.rpc.context.OriginContext. Available context types are defined in package google.rpc.context. Corresponds to the JSON property context


1561
1562
1563
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1561

def context
  @context
end

#controlGoogle::Apis::ServicemanagementV1::Control

Selects and configures the service controller used by the service. The service controller handles features like abuse, quota, billing, logging, monitoring, etc. Corresponds to the JSON property control



1607
1608
1609
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1607

def control
  @control
end

#custom_errorGoogle::Apis::ServicemanagementV1::CustomError

Customize service error responses. For example, list any service specific protobuf types that can appear in error detail lists of error responses. Example: custom_error: types:

  • google.foo.v1.CustomError
  • google.foo.v1.AnotherError Corresponds to the JSON property customError


1377
1378
1379
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1377

def custom_error
  @custom_error
end

#documentationGoogle::Apis::ServicemanagementV1::Documentation

Documentation provides the information for describing a service. Example:

documentation:
summary: >
The Google Calendar API gives access
to most calendar features.
pages:
- name: Overview
content: (== include google/foo/overview.md ==)
- name: Tutorial
content: (== include google/foo/tutorial.md ==)
subpages;
- name: Java
content: (== include google/foo/tutorial_java.md ==)
rules:
- selector: google.calendar.Calendar.Get
description: >
...
- selector: google.calendar.Calendar.Put
description: >
...

Documentation is provided in markdown syntax. In addition to standard markdown features, definition lists, tables and fenced code blocks are supported. Section headers can be provided and are interpreted relative to the section nesting of the context where a documentation fragment is embedded. Documentation from the IDL is merged with documentation defined via the config at normalization time, where documentation provided by config rules overrides IDL provided. A number of constructs specific to the API platform are supported in documentation text. In order to reference a proto element, the following notation can be used:

[fully.qualified.proto.name][]

To override the display text used for the link, this can be used:

[display text][fully.qualified.proto.name]

Text can be excluded from doc using the following notation:

(-- internal comment --)

Comments can be made conditional using a visibility label. The below text will be only rendered if the BETA label is available:

(--BETA: comment for BETA users --)

A few directives are available in documentation. Note that directives must appear on a single line to be properly identified. The include directive includes a markdown file from an external source:

(== include path/to/file ==)

The resource_for directive marks a message to be the resource of a collection in REST view. If it is not specified, tools attempt to infer the resource from the operations in a collection:

(== resource_for v1.shelves.books ==)

The directive suppress_warning does not directly affect documentation and is documented together with service config validation. Corresponds to the JSON property documentation



1497
1498
1499
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1497

def documentation
  @documentation
end

#endpointsArray<Google::Apis::ServicemanagementV1::Endpoint>

Configuration for network endpoints. If this is empty, then an endpoint with the same name as the service is automatically generated to service all defined APIs. Corresponds to the JSON property endpoints



1389
1390
1391
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1389

def endpoints
  @endpoints
end

#enumsArray<Google::Apis::ServicemanagementV1::Enum>

A list of all enum types included in this API service. Enums referenced directly or indirectly by the apis are automatically included. Enums which are not referenced but shall be included should be listed here by name. Example: enums:

  • name: google.someapi.v1.SomeEnum Corresponds to the JSON property enums


1544
1545
1546
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1544

def enums
  @enums
end

#experimentalGoogle::Apis::ServicemanagementV1::Experimental

Experimental service configuration. These configuration options can only be used by whitelisted users. Corresponds to the JSON property experimental



1600
1601
1602
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1600

def experimental
  @experimental
end

#httpGoogle::Apis::ServicemanagementV1::Http

Defines the HTTP configuration for a service. It contains a list of HttpRule, each specifying the mapping of an RPC method to one or more HTTP REST API methods. Corresponds to the JSON property http



1426
1427
1428
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1426

def http
  @http
end

#idString

A unique ID for a specific instance of this message, typically assigned by the client for tracking purpose. If empty, the server may choose to generate one instead. Corresponds to the JSON property id

Returns:

  • (String)


1568
1569
1570
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1568

def id
  @id
end

#loggingGoogle::Apis::ServicemanagementV1::Logging

Logging configuration of the service. The following example shows how to configure logs to be sent to the producer and consumer projects. In the example, the activity_history log is sent to both the producer and consumer projects, whereas the purchase_history log is only sent to the producer project. monitored_resources:

  • type: library.googleapis.com/branch labels:
  • key: /city description: The city where the library branch is located in.
  • key: /name description: The name of the branch. logs:
  • name: activity_history labels:
  • key: /customer_id
  • name: purchase_history logging: producer_destinations:
  • monitored_resource: library.googleapis.com/branch logs:
  • activity_history
  • purchase_history consumer_destinations:
  • monitored_resource: library.googleapis.com/branch logs:
  • activity_history Corresponds to the JSON property logging


1534
1535
1536
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1534

def logging
  @logging
end

#logsArray<Google::Apis::ServicemanagementV1::LogDescriptor>

Defines the logs used by this service. Corresponds to the JSON property logs



1403
1404
1405
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1403

def logs
  @logs
end

#metricsArray<Google::Apis::ServicemanagementV1::MetricDescriptor>

Defines the metrics used by this service. Corresponds to the JSON property metrics



1578
1579
1580
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1578

def metrics
  @metrics
end

#monitored_resourcesArray<Google::Apis::ServicemanagementV1::MonitoredResourceDescriptor>

Defines the monitored resources used by this service. This is required by the Service.monitoring and Service.logging configurations. Corresponds to the JSON property monitoredResources



1503
1504
1505
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1503

def monitored_resources
  @monitored_resources
end

#monitoringGoogle::Apis::ServicemanagementV1::Monitoring

Monitoring configuration of the service. The example below shows how to configure monitored resources and metrics for monitoring. In the example, a monitored resource and two metrics are defined. The library.googleapis.com/book/returned_count metric is sent to both producer and consumer projects, whereas the library.googleapis.com/book/overdue_count metric is only sent to the consumer project. monitored_resources:

  • type: library.googleapis.com/branch labels:
  • key: /city description: The city where the library branch is located in.
  • key: /name description: The name of the branch. metrics:
  • name: library.googleapis.com/book/returned_count metric_kind: DELTA value_type: INT64 labels:
  • key: /customer_id
  • name: library.googleapis.com/book/overdue_count metric_kind: GAUGE value_type: INT64 labels:
  • key: /customer_id monitoring: producer_destinations:
  • monitored_resource: library.googleapis.com/branch metrics:
  • library.googleapis.com/book/returned_count consumer_destinations:
  • monitored_resource: library.googleapis.com/branch metrics:
  • library.googleapis.com/book/returned_count
  • library.googleapis.com/book/overdue_count Corresponds to the JSON property monitoring


1654
1655
1656
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1654

def monitoring
  @monitoring
end

#nameString

The DNS address at which this service is available, e.g. calendar.googleapis.com. Corresponds to the JSON property name

Returns:

  • (String)


1365
1366
1367
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1365

def name
  @name
end

#producer_project_idString

The id of the Google developer project that owns the service. Members of this project can manage the service configuration, manage consumption of the service, etc. Corresponds to the JSON property producerProjectId

Returns:

  • (String)


1661
1662
1663
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1661

def producer_project_id
  @producer_project_id
end

#quotaGoogle::Apis::ServicemanagementV1::Quota

Quota configuration helps to achieve fairness and budgeting in service usage.

  • Fairness is achieved through the use of short-term quota limits that are usually defined over a time window of several seconds or minutes. When such a limit is applied, for example at the user level, it ensures that no single user will monopolize the service or a given customer's allocated portion of it.
  • Budgeting is achieved through the use of long-term quota limits that are usually defined over a time window of one or more days. These limits help client application developers predict the usage and help budgeting. Quota enforcement uses a simple token-based algorithm for resource sharing. The quota configuration structure is as follows:
  • QuotaLimit defines a single enforceable limit with a specified token amount that can be consumed over a specific duration and applies to a particular entity, like a project or an end user. If the limit applies to a user, each user making the request will get the specified number of tokens to consume. When the tokens run out, the requests from that user will be blocked until the duration elapses and the next duration window starts.
  • QuotaGroup groups a set of quota limits.
  • QuotaRule maps a method to a set of quota groups. This allows sharing of quota groups across methods as well as one method consuming tokens from more than one quota group. When a group contains multiple limits, requests to a method consuming tokens from that group must satisfy all the limits in that group. Example: quota: groups:
  • name: ReadGroup description: Read requests limits:
  • name: ProjectQps default_limit: 10000 duration: 100s limit_by: CLIENT_PROJECT
  • name: UserQps default_limit: 200 duration: 100s limit_by: USER
  • name: WriteGroup description: Write requests limits:
  • name: ProjectQps default_limit: 1000 max_limit: 2000 duration: 100s limit_by: CLIENT_PROJECT
  • name: UserQps default_limit: 200 max_limit: 400 duration: 100s limit_by: USER rules:
  • selector: "*" groups:
  • group: ReadGroup
  • selector: google.calendar.Calendar.Update groups:
  • group: WriteGroup cost: 2
  • selector: google.calendar.Calendar.Delete groups:
  • group: WriteGroup Here, the configuration defines two quota groups: ReadGroup and WriteGroup, each defining its own per-second and per-second-per-user limits. Note that One Platform enforces per-second limits averaged over 100 second window. The rules map ReadGroup for all methods, except for Update and Delete. These two methods consume from WriteGroup, with Update method consuming at twice the rate as Delete method. Multiple quota groups can be specified for a method. The quota limits in all of those groups will be enforced. Example: quota: groups:
  • name: WriteGroup description: Write requests limits:
  • name: ProjectQps default_limit: 1000 max_limit: 1000 duration: 100s limit_by: CLIENT_PROJECT
  • name: UserQps default_limit: 200 max_limit: 400 duration: 100s limit_by: USER
  • name: StorageGroup description: Storage requests limits:
  • name: StorageQuota default_limit: 1000 duration: 0 limit_by: USER rules:
  • selector: google.calendar.Calendar.Create groups:
  • group: StorageGroup
  • group: WriteGroup
  • selector: google.calendar.Calendar.Delete groups:
  • group: StorageGroup In the above example, the Create and Delete methods manage the user's storage space. In addition, Create method uses WriteGroup to manage the requests. In this case, requests to Create method need to satisfy all quota limits defined in both quota groups. One can disable quota for selected method(s) identified by the selector by setting disable_quota to true. For example, rules:
  • selector: "*" group:
  • group ReadGroup
  • selector: google.calendar.Calendar.Select disable_quota: true We are deprecating the group based quota configuration described above, and moving to use metric based quota configuration described below. The quota configuration works this way:
  • The service configuration defines a set of metrics.
  • For API calls, the quota.metric_rules maps methods to metrics with corresponding costs.
  • The quota.limits defines limits on the metrics, which will be used for quota checks at runtime. An example quota configuration in yaml format: quota: limits:
  • name: apiReadQpsPerProjectPerUser metric: library.googleapis.com/read_calls unit: "1/min/project/user" # per-user limit for consumer projects values: STANDARD: 1000
  • name: apiWriteQpsPerProject metric: library.googleapis.com/write_calls unit: "1/min/project" # rate limit for consumer projects values: STANDARD: 10000
  • name: borrowedCountPerOrganization metric: library.googleapis.com/borrowed_count is_precise: true unit: "1/organization" # allocation limit for organizations values: LOW: 200 STANDARD: 1000 HIGH: 10000
  • name: borrowedCountPerOrganizationPerRegion metric: library.googleapis.com/borrowed_count unit: "1/organization/region" is_precise: true values: LOW: 20 STANDARD: 200 HIGH: 2000 VERY_HIGH: 5000 LOW/us-central1: 50 STANDARD/us-central1: 500 HIGH/us-central1: 4000 VERY_HIGH/us-central1: 5000 # The metric rules bind all methods to the read_calls metric, # except for the UpdateBook and DeleteBook methods. These two methods # are mapped to the write_calls metric, with the UpdateBook method # consuming at twice rate as the DeleteBook method. metric_rules:
  • selector: "*" metric_costs: library.googleapis.com/read_calls: 1
  • selector: google.example.library.v1.LibraryService.UpdateBook metric_costs: library.googleapis.com/write_calls: 2
  • selector: google.example.library.v1.LibraryService.DeleteBook metric_costs: library.googleapis.com/write_calls: 1 Corresponding Metric definition: metrics:
  • name: library.googleapis.com/read_calls display_name: Read requests metric_kind: DELTA value_type: INT64
  • name: library.googleapis.com/write_calls display_name: Write requests metric_kind: DELTA value_type: INT64
  • name: library.googleapis.com/borrowed_count display_name: Borrowed books metric_kind: DELTA value_type: INT64 Corresponds to the JSON property quota


1359
1360
1361
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1359

def quota
  @quota
end

#source_infoGoogle::Apis::ServicemanagementV1::SourceInfo

Source information used to create a Service Config Corresponds to the JSON property sourceInfo



1419
1420
1421
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1419

def source_info
  @source_info
end

#system_parametersGoogle::Apis::ServicemanagementV1::SystemParameters

System parameter configuration

A system parameter is a special kind of parameter defined by the API system, not by an individual API. It is typically mapped to an HTTP header and/or a URL query parameter. This configuration specifies which methods change the names of the system parameters. Corresponds to the JSON property systemParameters



1440
1441
1442
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1440

def system_parameters
  @system_parameters
end

#system_typesArray<Google::Apis::ServicemanagementV1::Type>

A list of all proto message types included in this API service. It serves similar purpose as [google.api.Service.types], except that these types are not needed by user-defined APIs. Therefore, they will not show up in the generated discovery doc. This field should only be used to define system APIs in ESF. Corresponds to the JSON property systemTypes



1670
1671
1672
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1670

def system_types
  @system_types
end

#titleString

The product title associated with this service. Corresponds to the JSON property title

Returns:

  • (String)


1382
1383
1384
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1382

def title
  @title
end

#typesArray<Google::Apis::ServicemanagementV1::Type>

A list of all proto message types included in this API service. Types referenced directly or indirectly by the apis are automatically included. Messages which are not referenced but shall be included, such as types used by the google.protobuf.Any type, should be listed here by name. Example: types:

  • name: google.protobuf.Int32 Corresponds to the JSON property types


1414
1415
1416
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1414

def types
  @types
end

#usageGoogle::Apis::ServicemanagementV1::Usage

Configuration controlling usage of a service. Corresponds to the JSON property usage



1573
1574
1575
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1573

def usage
  @usage
end

#visibilityGoogle::Apis::ServicemanagementV1::Visibility

Visibility defines restrictions for the visibility of service elements. Restrictions are specified using visibility labels (e.g., TRUSTED_TESTER) that are elsewhere linked to users and projects. Users and projects can have access to more than one visibility label. The effective visibility for multiple labels is the union of each label's elements, plus any unrestricted elements. If an element and its parents have no restrictions, visibility is unconditionally granted. Example: visibility: rules:

  • selector: google.calendar.Calendar.EnhancedSearch restriction: TRUSTED_TESTER
  • selector: google.calendar.Calendar.Delegate restriction: GOOGLE_INTERNAL Here, all methods are publicly visible except for the restricted methods EnhancedSearch and Delegate. Corresponds to the JSON property visibility


1171
1172
1173
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1171

def visibility
  @visibility
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
# File 'generated/google/apis/servicemanagement_v1/classes.rb', line 1677

def update!(**args)
  @visibility = args[:visibility] if args.key?(:visibility)
  @quota = args[:quota] if args.key?(:quota)
  @name = args[:name] if args.key?(:name)
  @custom_error = args[:custom_error] if args.key?(:custom_error)
  @title = args[:title] if args.key?(:title)
  @endpoints = args[:endpoints] if args.key?(:endpoints)
  @apis = args[:apis] if args.key?(:apis)
  @logs = args[:logs] if args.key?(:logs)
  @types = args[:types] if args.key?(:types)
  @source_info = args[:source_info] if args.key?(:source_info)
  @http = args[:http] if args.key?(:http)
  @backend = args[:backend] if args.key?(:backend)
  @system_parameters = args[:system_parameters] if args.key?(:system_parameters)
  @documentation = args[:documentation] if args.key?(:documentation)
  @monitored_resources = args[:monitored_resources] if args.key?(:monitored_resources)
  @logging = args[:logging] if args.key?(:logging)
  @enums = args[:enums] if args.key?(:enums)
  @context = args[:context] if args.key?(:context)
  @id = args[:id] if args.key?(:id)
  @usage = args[:usage] if args.key?(:usage)
  @metrics = args[:metrics] if args.key?(:metrics)
  @authentication = args[:authentication] if args.key?(:authentication)
  @experimental = args[:experimental] if args.key?(:experimental)
  @control = args[:control] if args.key?(:control)
  @config_version = args[:config_version] if args.key?(:config_version)
  @monitoring = args[:monitoring] if args.key?(:monitoring)
  @producer_project_id = args[:producer_project_id] if args.key?(:producer_project_id)
  @system_types = args[:system_types] if args.key?(:system_types)
end