<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/cloud/apihub/v1/plugin_service.proto

namespace Google\Cloud\ApiHub\V1\Plugin\ConfigTemplate;

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

/**
 * AuthConfigTemplate represents the authentication template for a plugin.
 *
 * Generated from protobuf message <code>google.cloud.apihub.v1.Plugin.ConfigTemplate.AuthConfigTemplate</code>
 */
class AuthConfigTemplate extends \Google\Protobuf\Internal\Message
{
    /**
     * Required. The list of authentication types supported by the plugin.
     *
     * Generated from protobuf field <code>repeated .google.cloud.apihub.v1.AuthType supported_auth_types = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     */
    private $supported_auth_types;
    /**
     * Optional. The service account of the plugin hosting service.
     * This service account should be granted the required permissions on the
     * Auth Config parameters provided while creating the plugin instances
     * corresponding to this plugin.
     * For example, if the plugin instance auth config requires a secret
     * manager secret, the service account should be granted the
     * secretmanager.versions.access permission on the corresponding secret,
     * if the plugin instance auth config contains a service account, the
     * service account should be granted the
     * iam.serviceAccounts.getAccessToken permission on the corresponding
     * service account.
     *
     * Generated from protobuf field <code>.google.cloud.apihub.v1.GoogleServiceAccountConfig service_account = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     */
    protected $service_account = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type array<int>|\Google\Protobuf\Internal\RepeatedField $supported_auth_types
     *           Required. The list of authentication types supported by the plugin.
     *     @type \Google\Cloud\ApiHub\V1\GoogleServiceAccountConfig $service_account
     *           Optional. The service account of the plugin hosting service.
     *           This service account should be granted the required permissions on the
     *           Auth Config parameters provided while creating the plugin instances
     *           corresponding to this plugin.
     *           For example, if the plugin instance auth config requires a secret
     *           manager secret, the service account should be granted the
     *           secretmanager.versions.access permission on the corresponding secret,
     *           if the plugin instance auth config contains a service account, the
     *           service account should be granted the
     *           iam.serviceAccounts.getAccessToken permission on the corresponding
     *           service account.
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Cloud\Apihub\V1\PluginService::initOnce();
        parent::__construct($data);
    }

    /**
     * Required. The list of authentication types supported by the plugin.
     *
     * Generated from protobuf field <code>repeated .google.cloud.apihub.v1.AuthType supported_auth_types = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @return \Google\Protobuf\Internal\RepeatedField
     */
    public function getSupportedAuthTypes()
    {
        return $this->supported_auth_types;
    }

    /**
     * Required. The list of authentication types supported by the plugin.
     *
     * Generated from protobuf field <code>repeated .google.cloud.apihub.v1.AuthType supported_auth_types = 1 [(.google.api.field_behavior) = REQUIRED];</code>
     * @param array<int>|\Google\Protobuf\Internal\RepeatedField $var
     * @return $this
     */
    public function setSupportedAuthTypes($var)
    {
        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\ApiHub\V1\AuthType::class);
        $this->supported_auth_types = $arr;

        return $this;
    }

    /**
     * Optional. The service account of the plugin hosting service.
     * This service account should be granted the required permissions on the
     * Auth Config parameters provided while creating the plugin instances
     * corresponding to this plugin.
     * For example, if the plugin instance auth config requires a secret
     * manager secret, the service account should be granted the
     * secretmanager.versions.access permission on the corresponding secret,
     * if the plugin instance auth config contains a service account, the
     * service account should be granted the
     * iam.serviceAccounts.getAccessToken permission on the corresponding
     * service account.
     *
     * Generated from protobuf field <code>.google.cloud.apihub.v1.GoogleServiceAccountConfig service_account = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @return \Google\Cloud\ApiHub\V1\GoogleServiceAccountConfig|null
     */
    public function getServiceAccount()
    {
        return $this->service_account;
    }

    public function hasServiceAccount()
    {
        return isset($this->service_account);
    }

    public function clearServiceAccount()
    {
        unset($this->service_account);
    }

    /**
     * Optional. The service account of the plugin hosting service.
     * This service account should be granted the required permissions on the
     * Auth Config parameters provided while creating the plugin instances
     * corresponding to this plugin.
     * For example, if the plugin instance auth config requires a secret
     * manager secret, the service account should be granted the
     * secretmanager.versions.access permission on the corresponding secret,
     * if the plugin instance auth config contains a service account, the
     * service account should be granted the
     * iam.serviceAccounts.getAccessToken permission on the corresponding
     * service account.
     *
     * Generated from protobuf field <code>.google.cloud.apihub.v1.GoogleServiceAccountConfig service_account = 2 [(.google.api.field_behavior) = OPTIONAL];</code>
     * @param \Google\Cloud\ApiHub\V1\GoogleServiceAccountConfig $var
     * @return $this
     */
    public function setServiceAccount($var)
    {
        GPBUtil::checkMessage($var, \Google\Cloud\ApiHub\V1\GoogleServiceAccountConfig::class);
        $this->service_account = $var;

        return $this;
    }

}


