# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from __future__ import annotations

from typing import List

from alibabacloud_cloudapi20160714 import models as main_models
from darabonba.model import DaraModel

class ModifyApiGroupRequest(DaraModel):
    def __init__(
        self,
        base_path: str = None,
        compatible_flags: str = None,
        custom_app_code_config: str = None,
        custom_trace_config: str = None,
        customer_configs: str = None,
        default_domain: str = None,
        description: str = None,
        filter_app_code_for_backend: str = None,
        group_id: str = None,
        group_name: str = None,
        passthrough_headers: str = None,
        rpc_pattern: str = None,
        rps_limit_for_serverless: str = None,
        security_token: str = None,
        support_sse: str = None,
        tag: List[main_models.ModifyApiGroupRequestTag] = None,
        user_log_config: str = None,
    ):
        # The root path of the API.
        self.base_path = base_path
        # The list of associated tags. Separate multiple tags with commas (,).
        self.compatible_flags = compatible_flags
        # The custom appcode configuration.
        self.custom_app_code_config = custom_app_code_config
        # The custom trace configuration.
        self.custom_trace_config = custom_trace_config
        # The data of custom configuration items.
        self.customer_configs = customer_configs
        # The default domain name.
        self.default_domain = default_domain
        # The API group description that you want to specify, which cannot exceed 180 characters. If this parameter is not specified, the group description is not modified.
        self.description = description
        # If filter AppCode for backend.
        self.filter_app_code_for_backend = filter_app_code_for_backend
        # The ID of the API group. This ID is generated by the system and globally unique.
        # 
        # This parameter is required.
        self.group_id = group_id
        # The API group name must be globally unique. The name must be 4 to 50 characters in length. It must start with a letter and can contain letters, digits, and underscores (_). If this parameter is not specified, the group name is not modified.
        self.group_name = group_name
        # Specifies whether to pass headers.
        self.passthrough_headers = passthrough_headers
        # The RPC mode.
        self.rpc_pattern = rpc_pattern
        self.rps_limit_for_serverless = rps_limit_for_serverless
        self.security_token = security_token
        # If support SSE.
        self.support_sse = support_sse
        # The object tags that match the lifecycle rule. You can specify multiple tags.
        self.tag = tag
        # The user log configuration.
        self.user_log_config = user_log_config

    def validate(self):
        if self.tag:
            for v1 in self.tag:
                 if v1:
                    v1.validate()

    def to_map(self):
        result = dict()
        _map = super().to_map()
        if _map is not None:
            result = _map
        if self.base_path is not None:
            result['BasePath'] = self.base_path

        if self.compatible_flags is not None:
            result['CompatibleFlags'] = self.compatible_flags

        if self.custom_app_code_config is not None:
            result['CustomAppCodeConfig'] = self.custom_app_code_config

        if self.custom_trace_config is not None:
            result['CustomTraceConfig'] = self.custom_trace_config

        if self.customer_configs is not None:
            result['CustomerConfigs'] = self.customer_configs

        if self.default_domain is not None:
            result['DefaultDomain'] = self.default_domain

        if self.description is not None:
            result['Description'] = self.description

        if self.filter_app_code_for_backend is not None:
            result['FilterAppCodeForBackend'] = self.filter_app_code_for_backend

        if self.group_id is not None:
            result['GroupId'] = self.group_id

        if self.group_name is not None:
            result['GroupName'] = self.group_name

        if self.passthrough_headers is not None:
            result['PassthroughHeaders'] = self.passthrough_headers

        if self.rpc_pattern is not None:
            result['RpcPattern'] = self.rpc_pattern

        if self.rps_limit_for_serverless is not None:
            result['RpsLimitForServerless'] = self.rps_limit_for_serverless

        if self.security_token is not None:
            result['SecurityToken'] = self.security_token

        if self.support_sse is not None:
            result['SupportSSE'] = self.support_sse

        result['Tag'] = []
        if self.tag is not None:
            for k1 in self.tag:
                result['Tag'].append(k1.to_map() if k1 else None)

        if self.user_log_config is not None:
            result['UserLogConfig'] = self.user_log_config

        return result

    def from_map(self, m: dict = None):
        m = m or dict()
        if m.get('BasePath') is not None:
            self.base_path = m.get('BasePath')

        if m.get('CompatibleFlags') is not None:
            self.compatible_flags = m.get('CompatibleFlags')

        if m.get('CustomAppCodeConfig') is not None:
            self.custom_app_code_config = m.get('CustomAppCodeConfig')

        if m.get('CustomTraceConfig') is not None:
            self.custom_trace_config = m.get('CustomTraceConfig')

        if m.get('CustomerConfigs') is not None:
            self.customer_configs = m.get('CustomerConfigs')

        if m.get('DefaultDomain') is not None:
            self.default_domain = m.get('DefaultDomain')

        if m.get('Description') is not None:
            self.description = m.get('Description')

        if m.get('FilterAppCodeForBackend') is not None:
            self.filter_app_code_for_backend = m.get('FilterAppCodeForBackend')

        if m.get('GroupId') is not None:
            self.group_id = m.get('GroupId')

        if m.get('GroupName') is not None:
            self.group_name = m.get('GroupName')

        if m.get('PassthroughHeaders') is not None:
            self.passthrough_headers = m.get('PassthroughHeaders')

        if m.get('RpcPattern') is not None:
            self.rpc_pattern = m.get('RpcPattern')

        if m.get('RpsLimitForServerless') is not None:
            self.rps_limit_for_serverless = m.get('RpsLimitForServerless')

        if m.get('SecurityToken') is not None:
            self.security_token = m.get('SecurityToken')

        if m.get('SupportSSE') is not None:
            self.support_sse = m.get('SupportSSE')

        self.tag = []
        if m.get('Tag') is not None:
            for k1 in m.get('Tag'):
                temp_model = main_models.ModifyApiGroupRequestTag()
                self.tag.append(temp_model.from_map(k1))

        if m.get('UserLogConfig') is not None:
            self.user_log_config = m.get('UserLogConfig')

        return self

class ModifyApiGroupRequestTag(DaraModel):
    def __init__(
        self,
        key: str = None,
        value: str = None,
    ):
        # The key of the tag.
        # 
        # This parameter is required.
        self.key = key
        # The value of the tag.
        # 
        # This parameter is required.
        self.value = value

    def validate(self):
        pass

    def to_map(self):
        result = dict()
        _map = super().to_map()
        if _map is not None:
            result = _map
        if self.key is not None:
            result['Key'] = self.key

        if self.value is not None:
            result['Value'] = self.value

        return result

    def from_map(self, m: dict = None):
        m = m or dict()
        if m.get('Key') is not None:
            self.key = m.get('Key')

        if m.get('Value') is not None:
            self.value = m.get('Value')

        return self

