# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
#     ***     AUTO GENERATED CODE    ***    Type: MMv1     ***
#
# ----------------------------------------------------------------------------
#
#     This file is automatically generated by Magic Modules and manual
#     changes will be clobbered when the file is regenerated.
#
#     Please read more about how to change this file in README.md and
#     CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'gcp_backend'

# A provider to manage Compute Engine resources.
class ComputeRegionTargetHttpsProxy < GcpResourceBase
  name 'google_compute_region_target_https_proxy'
  desc 'RegionTargetHttpsProxy'
  supports platform: 'gcp'

  attr_reader :params
  attr_reader :kind
  attr_reader :id
  attr_reader :creation_timestamp
  attr_reader :name
  attr_reader :description
  attr_reader :self_link
  attr_reader :self_link_with_id
  attr_reader :url_map
  attr_reader :ssl_certificates
  attr_reader :certificate_map
  attr_reader :quic_override
  attr_reader :ssl_policy
  attr_reader :region
  attr_reader :proxy_bind
  attr_reader :http_filters
  attr_reader :server_tls_policy
  attr_reader :authentication
  attr_reader :authorization_policy
  attr_reader :authorization
  attr_reader :fingerprint
  attr_reader :http_keep_alive_timeout_sec
  attr_reader :tls_early_data

  def initialize(params)
    super(params.merge({ use_http_transport: true }))
    @params = params
    @fetched = @connection.fetch(product_url(params[:beta]), resource_base_url, params, 'Get')
    parse unless @fetched.nil?
  end

  def parse
    @kind = @fetched['kind']
    @id = @fetched['id']
    @creation_timestamp = @fetched['creationTimestamp']
    @name = @fetched['name']
    @description = @fetched['description']
    @self_link = @fetched['selfLink']
    @self_link_with_id = @fetched['selfLinkWithId']
    @url_map = @fetched['urlMap']
    @ssl_certificates = @fetched['sslCertificates']
    @certificate_map = @fetched['certificateMap']
    @quic_override = @fetched['quicOverride']
    @ssl_policy = @fetched['sslPolicy']
    @region = @fetched['region']
    @proxy_bind = @fetched['proxyBind']
    @http_filters = @fetched['httpFilters']
    @server_tls_policy = @fetched['serverTlsPolicy']
    @authentication = @fetched['authentication']
    @authorization_policy = @fetched['authorizationPolicy']
    @authorization = @fetched['authorization']
    @fingerprint = @fetched['fingerprint']
    @http_keep_alive_timeout_sec = @fetched['httpKeepAliveTimeoutSec']
    @tls_early_data = @fetched['tlsEarlyData']
  end

  def exists?
    !@fetched.nil?
  end

  def to_s
    "RegionTargetHttpsProxy #{@params[:targetHttpsProxy]}"
  end

  private

  def product_url(_ = nil)
    'https://compute.googleapis.com/compute/v1/'
  end

  def resource_base_url
    'projects/{{project}}/regions/{{region}}/targetHttpsProxies/{{target_https_proxy}}'
  end
end
