<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/api/apikeys/v2/resources.proto

namespace Google\Cloud\ApiKeys\V2;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\GPBUtil;
use Google\Protobuf\RepeatedField;

/**
 * A restriction for a specific service and optionally one or multiple
 * specific methods. Both fields are case insensitive.
 *
 * Generated from protobuf message <code>google.api.apikeys.v2.ApiTarget</code>
 */
class ApiTarget extends \Google\Protobuf\Internal\Message
{
    /**
     * The service for this restriction. It should be the canonical
     * service name, for example: `translate.googleapis.com`.
     * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
     * to get a list of services that are enabled in the project.
     *
     * Generated from protobuf field <code>string service = 1;</code>
     */
    protected $service = '';
    /**
     * Optional. List of one or more methods that can be called.
     * If empty, all methods for the service are allowed. A wildcard
     * (*) can be used as the last symbol.
     * Valid examples:
     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
     *   `TranslateText`
     *   `Get*`
     *   `translate.googleapis.com.Get*`
     *
     * Generated from protobuf field <code>repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    private $methods;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $service
     *           The service for this restriction. It should be the canonical
     *           service name, for example: `translate.googleapis.com`.
     *           You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
     *           to get a list of services that are enabled in the project.
     *     @type string[] $methods
     *           Optional. List of one or more methods that can be called.
     *           If empty, all methods for the service are allowed. A wildcard
     *           (*) can be used as the last symbol.
     *           Valid examples:
     *             `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
     *             `TranslateText`
     *             `Get*`
     *             `translate.googleapis.com.Get*`
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Api\Apikeys\V2\Resources::initOnce();
        parent::__construct($data);
    }

    /**
     * The service for this restriction. It should be the canonical
     * service name, for example: `translate.googleapis.com`.
     * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
     * to get a list of services that are enabled in the project.
     *
     * Generated from protobuf field <code>string service = 1;</code>
     * @return string
     */
    public function getService()
    {
        return $this->service;
    }

    /**
     * The service for this restriction. It should be the canonical
     * service name, for example: `translate.googleapis.com`.
     * You can use [`gcloud services list`](/sdk/gcloud/reference/services/list)
     * to get a list of services that are enabled in the project.
     *
     * Generated from protobuf field <code>string service = 1;</code>
     * @param string $var
     * @return $this
     */
    public function setService($var)
    {
        GPBUtil::checkString($var, True);
        $this->service = $var;

        return $this;
    }

    /**
     * Optional. List of one or more methods that can be called.
     * If empty, all methods for the service are allowed. A wildcard
     * (*) can be used as the last symbol.
     * Valid examples:
     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
     *   `TranslateText`
     *   `Get*`
     *   `translate.googleapis.com.Get*`
     *
     * Generated from protobuf field <code>repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return RepeatedField<string>
     */
    public function getMethods()
    {
        return $this->methods;
    }

    /**
     * Optional. List of one or more methods that can be called.
     * If empty, all methods for the service are allowed. A wildcard
     * (*) can be used as the last symbol.
     * Valid examples:
     *   `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`
     *   `TranslateText`
     *   `Get*`
     *   `translate.googleapis.com.Get*`
     *
     * Generated from protobuf field <code>repeated string methods = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param string[] $var
     * @return $this
     */
    public function setMethods($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING);
        $this->methods = $arr;

        return $this;
    }

}

