From 3e16bdc22ff2fc2a48ff18bc58a2e649f00d3438 Mon Sep 17 00:00:00 2001 From: declement Date: Tue, 9 Jul 2024 14:16:46 +0200 Subject: [PATCH 1/3] feat: add tags group Signed-off-by: declement --- config/externalname.go | 9 +++++ config/externalnamenottested.go | 6 ---- config/generated.lst | 2 +- config/provider.go | 2 ++ config/tags/config.go | 33 ++++++++++++++++++ examples/tags/v1beta1/tagbinding.yaml | 50 +++++++++++++++++++++++++++ examples/tags/v1beta1/tagkey.yaml | 14 ++++++++ examples/tags/v1beta1/tagvalue.yaml | 32 +++++++++++++++++ 8 files changed, 141 insertions(+), 7 deletions(-) create mode 100644 config/tags/config.go create mode 100644 examples/tags/v1beta1/tagbinding.yaml create mode 100644 examples/tags/v1beta1/tagkey.yaml create mode 100644 examples/tags/v1beta1/tagvalue.yaml diff --git a/config/externalname.go b/config/externalname.go index 34940c935..e7d66923d 100644 --- a/config/externalname.go +++ b/config/externalname.go @@ -993,6 +993,15 @@ var terraformPluginSDKExternalNameConfigs = map[string]config.ExternalName{ "google_certificate_manager_dns_authorization": config.TemplatedStringAsIdentifier("name", "projects/{{ .setup.configuration.project }}/locations/{{ .parameters.location }}/dnsAuthorizations/{{ .external_name }}"), // Imported by using the following projects/{{project}}/locations/global/certificateMaps/{{map}}/certificateMapEntries/{{name}} "google_certificate_manager_certificate_map_entry": config.TemplatedStringAsIdentifier("name", "projects/{{ .setup.configuration.project }}/locations/global/certificateMaps/{{ .parameters.map }}/certificateMapEntries/{{ .external_name }}"), + + // tags + // + // Imported by using the following tagBindings/{{name}} + "google_tags_tag_binding": config.IdentifierFromProvider, + // Imported by using the following tagKeys/{{name}} + "google_tags_tag_key": config.IdentifierFromProvider, + // Imported by using the following tagValues/{{name}} + "google_tags_tag_value": config.IdentifierFromProvider, } // cliReconciledExternalNameConfigs contains all external name configurations diff --git a/config/externalnamenottested.go b/config/externalnamenottested.go index 5deffd840..0cad4cbd9 100644 --- a/config/externalnamenottested.go +++ b/config/externalnamenottested.go @@ -441,14 +441,8 @@ var ExternalNameNotTestedConfigs = map[string]config.ExternalName{ // tags // - // Imported by using the following tagKeys/{{name}} - "google_tags_tag_key": config.IdentifierFromProvider, // Imported by using the following tagKeys/{{tag_key}} roles/viewer user:jane@example.com "google_tags_tag_key_iam_member": config.TemplatedStringAsIdentifier("tag_key", "tagKeys/{{ .external_name }} {{ .parameters.role }} {{ .parameters.member }}"), - // Imported by using the following tagValues/{{name}} - "google_tags_tag_value": config.IdentifierFromProvider, // Imported by using the following tagValues/{{tag_value}} roles/viewer user:jane@example.com "google_tags_tag_value_iam_member": config.TemplatedStringAsIdentifier("tag_value", "tagValues/{{ .external_name }} {{ .parameters.role }} {{ .parameters.member }}"), - // Imported by using the following tagBindings/{{name}} - "google_tags_tag_binding": config.IdentifierFromProvider, } diff --git a/config/generated.lst b/config/generated.lst index fcbc48952..b9944fe9d 100644 --- a/config/generated.lst +++ b/config/generated.lst @@ -1 +1 @@ -["google_access_context_manager_access_level","google_access_context_manager_access_level_condition","google_access_context_manager_access_policy","google_access_context_manager_access_policy_iam_member","google_access_context_manager_service_perimeter","google_access_context_manager_service_perimeter_resource","google_active_directory_domain","google_alloydb_backup","google_alloydb_cluster","google_alloydb_instance","google_apigee_envgroup","google_apigee_environment","google_apigee_environment_iam_member","google_apigee_instance","google_apigee_nat_address","google_apigee_organization","google_app_engine_application","google_app_engine_application_url_dispatch_rules","google_app_engine_firewall_rule","google_app_engine_service_network_settings","google_app_engine_standard_app_version","google_artifact_registry_repository","google_artifact_registry_repository_iam_member","google_beyondcorp_app_connection","google_beyondcorp_app_connector","google_beyondcorp_app_gateway","google_bigquery_analytics_hub_data_exchange","google_bigquery_analytics_hub_data_exchange_iam_member","google_bigquery_analytics_hub_listing","google_bigquery_connection","google_bigquery_data_transfer_config","google_bigquery_dataset","google_bigquery_dataset_access","google_bigquery_dataset_iam_binding","google_bigquery_dataset_iam_member","google_bigquery_dataset_iam_policy","google_bigquery_job","google_bigquery_reservation","google_bigquery_reservation_assignment","google_bigquery_routine","google_bigquery_table","google_bigquery_table_iam_binding","google_bigquery_table_iam_member","google_bigquery_table_iam_policy","google_bigtable_app_profile","google_bigtable_gc_policy","google_bigtable_instance","google_bigtable_instance_iam_binding","google_bigtable_instance_iam_member","google_bigtable_instance_iam_policy","google_bigtable_table","google_bigtable_table_iam_binding","google_bigtable_table_iam_member","google_bigtable_table_iam_policy","google_binary_authorization_attestor","google_binary_authorization_policy","google_certificate_manager_certificate","google_certificate_manager_certificate_map","google_certificate_manager_certificate_map_entry","google_certificate_manager_dns_authorization","google_cloud_ids_endpoint","google_cloud_run_domain_mapping","google_cloud_run_service","google_cloud_run_service_iam_member","google_cloud_run_v2_job","google_cloud_run_v2_service","google_cloud_scheduler_job","google_cloud_tasks_queue","google_cloudbuild_trigger","google_cloudbuild_worker_pool","google_cloudfunctions2_function","google_cloudfunctions_function","google_cloudfunctions_function_iam_member","google_composer_environment","google_compute_address","google_compute_attached_disk","google_compute_autoscaler","google_compute_backend_bucket","google_compute_backend_bucket_signed_url_key","google_compute_backend_service","google_compute_backend_service_signed_url_key","google_compute_disk","google_compute_disk_iam_member","google_compute_disk_resource_policy_attachment","google_compute_external_vpn_gateway","google_compute_firewall","google_compute_firewall_policy","google_compute_firewall_policy_association","google_compute_firewall_policy_rule","google_compute_forwarding_rule","google_compute_global_address","google_compute_global_forwarding_rule","google_compute_global_network_endpoint","google_compute_global_network_endpoint_group","google_compute_ha_vpn_gateway","google_compute_health_check","google_compute_http_health_check","google_compute_https_health_check","google_compute_image","google_compute_image_iam_member","google_compute_instance","google_compute_instance_from_template","google_compute_instance_group","google_compute_instance_group_manager","google_compute_instance_group_named_port","google_compute_instance_iam_member","google_compute_instance_template","google_compute_interconnect_attachment","google_compute_managed_ssl_certificate","google_compute_network","google_compute_network_endpoint","google_compute_network_endpoint_group","google_compute_network_firewall_policy","google_compute_network_firewall_policy_association","google_compute_network_peering","google_compute_network_peering_routes_config","google_compute_node_group","google_compute_node_template","google_compute_packet_mirroring","google_compute_per_instance_config","google_compute_project_default_network_tier","google_compute_project_metadata","google_compute_project_metadata_item","google_compute_region_autoscaler","google_compute_region_backend_service","google_compute_region_disk","google_compute_region_disk_iam_member","google_compute_region_disk_resource_policy_attachment","google_compute_region_health_check","google_compute_region_instance_group_manager","google_compute_region_network_endpoint","google_compute_region_network_endpoint_group","google_compute_region_network_firewall_policy","google_compute_region_network_firewall_policy_association","google_compute_region_per_instance_config","google_compute_region_ssl_certificate","google_compute_region_target_http_proxy","google_compute_region_target_https_proxy","google_compute_region_target_tcp_proxy","google_compute_region_url_map","google_compute_reservation","google_compute_resource_policy","google_compute_route","google_compute_router","google_compute_router_interface","google_compute_router_nat","google_compute_router_peer","google_compute_security_policy","google_compute_service_attachment","google_compute_shared_vpc_host_project","google_compute_shared_vpc_service_project","google_compute_snapshot","google_compute_snapshot_iam_member","google_compute_ssl_certificate","google_compute_ssl_policy","google_compute_subnetwork","google_compute_subnetwork_iam_member","google_compute_target_grpc_proxy","google_compute_target_http_proxy","google_compute_target_https_proxy","google_compute_target_instance","google_compute_target_pool","google_compute_target_ssl_proxy","google_compute_target_tcp_proxy","google_compute_url_map","google_compute_vpn_gateway","google_compute_vpn_tunnel","google_container_analysis_note","google_container_attached_cluster","google_container_aws_cluster","google_container_aws_node_pool","google_container_azure_client","google_container_azure_cluster","google_container_azure_node_pool","google_container_cluster","google_container_node_pool","google_container_registry","google_data_catalog_entry","google_data_catalog_entry_group","google_data_catalog_tag","google_data_catalog_tag_template","google_data_fusion_instance","google_data_loss_prevention_deidentify_template","google_data_loss_prevention_inspect_template","google_data_loss_prevention_job_trigger","google_data_loss_prevention_stored_info_type","google_dataflow_job","google_dataplex_asset","google_dataplex_lake","google_dataplex_zone","google_dataproc_autoscaling_policy","google_dataproc_cluster","google_dataproc_job","google_dataproc_metastore_service","google_dataproc_workflow_template","google_datastore_index","google_datastream_connection_profile","google_datastream_private_connection","google_dialogflow_cx_agent","google_dialogflow_cx_entity_type","google_dialogflow_cx_environment","google_dialogflow_cx_flow","google_dialogflow_cx_intent","google_dialogflow_cx_page","google_dialogflow_cx_version","google_dialogflow_cx_webhook","google_dns_managed_zone","google_dns_managed_zone_iam_member","google_dns_policy","google_dns_record_set","google_document_ai_processor","google_essential_contacts_contact","google_eventarc_channel","google_eventarc_google_channel_config","google_eventarc_trigger","google_filestore_backup","google_filestore_instance","google_filestore_snapshot","google_firebaserules_release","google_firebaserules_ruleset","google_folder","google_folder_iam_member","google_gke_backup_backup_plan","google_gke_hub_membership","google_gke_hub_membership_iam_member","google_healthcare_consent_store","google_healthcare_dataset","google_healthcare_dataset_iam_member","google_iam_workload_identity_pool","google_iam_workload_identity_pool_provider","google_iap_app_engine_service_iam_member","google_iap_app_engine_version_iam_member","google_iap_tunnel_iam_member","google_iap_web_backend_service_iam_member","google_iap_web_iam_member","google_iap_web_type_app_engine_iam_member","google_iap_web_type_compute_iam_member","google_identity_platform_default_supported_idp_config","google_identity_platform_inbound_saml_config","google_identity_platform_oauth_idp_config","google_identity_platform_project_default_config","google_identity_platform_tenant","google_identity_platform_tenant_default_supported_idp_config","google_identity_platform_tenant_inbound_saml_config","google_identity_platform_tenant_oauth_idp_config","google_kms_crypto_key","google_kms_crypto_key_iam_member","google_kms_crypto_key_version","google_kms_key_ring","google_kms_key_ring_iam_member","google_kms_key_ring_import_job","google_kms_secret_ciphertext","google_logging_folder_bucket_config","google_logging_folder_exclusion","google_logging_folder_sink","google_logging_log_view","google_logging_metric","google_logging_project_bucket_config","google_logging_project_exclusion","google_logging_project_sink","google_memcache_instance","google_ml_engine_model","google_monitoring_alert_policy","google_monitoring_custom_service","google_monitoring_dashboard","google_monitoring_group","google_monitoring_metric_descriptor","google_monitoring_notification_channel","google_monitoring_service","google_monitoring_slo","google_monitoring_uptime_check_config","google_network_connectivity_hub","google_network_connectivity_spoke","google_network_management_connectivity_test","google_notebooks_environment","google_notebooks_instance","google_notebooks_instance_iam_member","google_notebooks_runtime","google_notebooks_runtime_iam_member","google_organization_iam_audit_config","google_organization_iam_custom_role","google_organization_iam_member","google_os_config_os_policy_assignment","google_os_config_patch_deployment","google_os_login_ssh_public_key","google_privateca_ca_pool","google_privateca_ca_pool_iam_member","google_privateca_certificate","google_privateca_certificate_authority","google_privateca_certificate_template","google_privateca_certificate_template_iam_member","google_project","google_project_default_service_accounts","google_project_iam_audit_config","google_project_iam_custom_role","google_project_iam_member","google_project_service","google_project_usage_export_bucket","google_pubsub_lite_reservation","google_pubsub_lite_subscription","google_pubsub_lite_topic","google_pubsub_schema","google_pubsub_subscription","google_pubsub_subscription_iam_member","google_pubsub_topic","google_pubsub_topic_iam_member","google_redis_instance","google_secret_manager_secret","google_secret_manager_secret_iam_member","google_secret_manager_secret_version","google_service_account","google_service_account_iam_member","google_service_account_key","google_service_networking_connection","google_service_networking_peered_dns_domain","google_sourcerepo_repository","google_sourcerepo_repository_iam_member","google_spanner_database","google_spanner_database_iam_member","google_spanner_instance","google_spanner_instance_iam_member","google_sql_database","google_sql_database_instance","google_sql_source_representation_instance","google_sql_ssl_cert","google_sql_user","google_storage_bucket","google_storage_bucket_access_control","google_storage_bucket_acl","google_storage_bucket_iam_member","google_storage_bucket_object","google_storage_default_object_access_control","google_storage_default_object_acl","google_storage_hmac_key","google_storage_notification","google_storage_object_access_control","google_storage_object_acl","google_storage_transfer_agent_pool","google_tpu_node","google_vertex_ai_dataset","google_vertex_ai_featurestore","google_vertex_ai_featurestore_entitytype","google_vertex_ai_tensorboard","google_vpc_access_connector","google_workflows_workflow"] \ No newline at end of file +["google_access_context_manager_access_level","google_access_context_manager_access_level_condition","google_access_context_manager_access_policy","google_access_context_manager_access_policy_iam_member","google_access_context_manager_service_perimeter","google_access_context_manager_service_perimeter_resource","google_active_directory_domain","google_alloydb_backup","google_alloydb_cluster","google_alloydb_instance","google_apigee_envgroup","google_apigee_environment","google_apigee_environment_iam_member","google_apigee_instance","google_apigee_nat_address","google_apigee_organization","google_app_engine_application","google_app_engine_application_url_dispatch_rules","google_app_engine_firewall_rule","google_app_engine_service_network_settings","google_app_engine_standard_app_version","google_artifact_registry_repository","google_artifact_registry_repository_iam_member","google_beyondcorp_app_connection","google_beyondcorp_app_connector","google_beyondcorp_app_gateway","google_bigquery_analytics_hub_data_exchange","google_bigquery_analytics_hub_data_exchange_iam_member","google_bigquery_analytics_hub_listing","google_bigquery_connection","google_bigquery_data_transfer_config","google_bigquery_dataset","google_bigquery_dataset_access","google_bigquery_dataset_iam_binding","google_bigquery_dataset_iam_member","google_bigquery_dataset_iam_policy","google_bigquery_job","google_bigquery_reservation","google_bigquery_reservation_assignment","google_bigquery_routine","google_bigquery_table","google_bigquery_table_iam_binding","google_bigquery_table_iam_member","google_bigquery_table_iam_policy","google_bigtable_app_profile","google_bigtable_gc_policy","google_bigtable_instance","google_bigtable_instance_iam_binding","google_bigtable_instance_iam_member","google_bigtable_instance_iam_policy","google_bigtable_table","google_bigtable_table_iam_binding","google_bigtable_table_iam_member","google_bigtable_table_iam_policy","google_binary_authorization_attestor","google_binary_authorization_policy","google_certificate_manager_certificate","google_certificate_manager_certificate_map","google_certificate_manager_certificate_map_entry","google_certificate_manager_dns_authorization","google_cloud_ids_endpoint","google_cloud_run_domain_mapping","google_cloud_run_service","google_cloud_run_service_iam_member","google_cloud_run_v2_job","google_cloud_run_v2_service","google_cloud_scheduler_job","google_cloud_tasks_queue","google_cloudbuild_trigger","google_cloudbuild_worker_pool","google_cloudfunctions2_function","google_cloudfunctions_function","google_cloudfunctions_function_iam_member","google_composer_environment","google_compute_address","google_compute_attached_disk","google_compute_autoscaler","google_compute_backend_bucket","google_compute_backend_bucket_signed_url_key","google_compute_backend_service","google_compute_backend_service_signed_url_key","google_compute_disk","google_compute_disk_iam_member","google_compute_disk_resource_policy_attachment","google_compute_external_vpn_gateway","google_compute_firewall","google_compute_firewall_policy","google_compute_firewall_policy_association","google_compute_firewall_policy_rule","google_compute_forwarding_rule","google_compute_global_address","google_compute_global_forwarding_rule","google_compute_global_network_endpoint","google_compute_global_network_endpoint_group","google_compute_ha_vpn_gateway","google_compute_health_check","google_compute_http_health_check","google_compute_https_health_check","google_compute_image","google_compute_image_iam_member","google_compute_instance","google_compute_instance_from_template","google_compute_instance_group","google_compute_instance_group_manager","google_compute_instance_group_named_port","google_compute_instance_iam_member","google_compute_instance_template","google_compute_interconnect_attachment","google_compute_managed_ssl_certificate","google_compute_network","google_compute_network_endpoint","google_compute_network_endpoint_group","google_compute_network_firewall_policy","google_compute_network_firewall_policy_association","google_compute_network_peering","google_compute_network_peering_routes_config","google_compute_node_group","google_compute_node_template","google_compute_packet_mirroring","google_compute_per_instance_config","google_compute_project_default_network_tier","google_compute_project_metadata","google_compute_project_metadata_item","google_compute_region_autoscaler","google_compute_region_backend_service","google_compute_region_disk","google_compute_region_disk_iam_member","google_compute_region_disk_resource_policy_attachment","google_compute_region_health_check","google_compute_region_instance_group_manager","google_compute_region_network_endpoint","google_compute_region_network_endpoint_group","google_compute_region_network_firewall_policy","google_compute_region_network_firewall_policy_association","google_compute_region_per_instance_config","google_compute_region_ssl_certificate","google_compute_region_target_http_proxy","google_compute_region_target_https_proxy","google_compute_region_target_tcp_proxy","google_compute_region_url_map","google_compute_reservation","google_compute_resource_policy","google_compute_route","google_compute_router","google_compute_router_interface","google_compute_router_nat","google_compute_router_peer","google_compute_security_policy","google_compute_service_attachment","google_compute_shared_vpc_host_project","google_compute_shared_vpc_service_project","google_compute_snapshot","google_compute_snapshot_iam_member","google_compute_ssl_certificate","google_compute_ssl_policy","google_compute_subnetwork","google_compute_subnetwork_iam_member","google_compute_target_grpc_proxy","google_compute_target_http_proxy","google_compute_target_https_proxy","google_compute_target_instance","google_compute_target_pool","google_compute_target_ssl_proxy","google_compute_target_tcp_proxy","google_compute_url_map","google_compute_vpn_gateway","google_compute_vpn_tunnel","google_container_analysis_note","google_container_attached_cluster","google_container_aws_cluster","google_container_aws_node_pool","google_container_azure_client","google_container_azure_cluster","google_container_azure_node_pool","google_container_cluster","google_container_node_pool","google_container_registry","google_data_catalog_entry","google_data_catalog_entry_group","google_data_catalog_tag","google_data_catalog_tag_template","google_data_fusion_instance","google_data_loss_prevention_deidentify_template","google_data_loss_prevention_inspect_template","google_data_loss_prevention_job_trigger","google_data_loss_prevention_stored_info_type","google_dataflow_job","google_dataplex_asset","google_dataplex_lake","google_dataplex_zone","google_dataproc_autoscaling_policy","google_dataproc_cluster","google_dataproc_job","google_dataproc_metastore_service","google_dataproc_workflow_template","google_datastore_index","google_datastream_connection_profile","google_datastream_private_connection","google_dialogflow_cx_agent","google_dialogflow_cx_entity_type","google_dialogflow_cx_environment","google_dialogflow_cx_flow","google_dialogflow_cx_intent","google_dialogflow_cx_page","google_dialogflow_cx_version","google_dialogflow_cx_webhook","google_dns_managed_zone","google_dns_managed_zone_iam_member","google_dns_policy","google_dns_record_set","google_document_ai_processor","google_essential_contacts_contact","google_eventarc_channel","google_eventarc_google_channel_config","google_eventarc_trigger","google_filestore_backup","google_filestore_instance","google_filestore_snapshot","google_firebaserules_release","google_firebaserules_ruleset","google_folder","google_folder_iam_member","google_gke_backup_backup_plan","google_gke_hub_membership","google_gke_hub_membership_iam_member","google_healthcare_consent_store","google_healthcare_dataset","google_healthcare_dataset_iam_member","google_iam_workload_identity_pool","google_iam_workload_identity_pool_provider","google_iap_app_engine_service_iam_member","google_iap_app_engine_version_iam_member","google_iap_tunnel_iam_member","google_iap_web_backend_service_iam_member","google_iap_web_iam_member","google_iap_web_type_app_engine_iam_member","google_iap_web_type_compute_iam_member","google_identity_platform_default_supported_idp_config","google_identity_platform_inbound_saml_config","google_identity_platform_oauth_idp_config","google_identity_platform_project_default_config","google_identity_platform_tenant","google_identity_platform_tenant_default_supported_idp_config","google_identity_platform_tenant_inbound_saml_config","google_identity_platform_tenant_oauth_idp_config","google_kms_crypto_key","google_kms_crypto_key_iam_member","google_kms_crypto_key_version","google_kms_key_ring","google_kms_key_ring_iam_member","google_kms_key_ring_import_job","google_kms_secret_ciphertext","google_logging_folder_bucket_config","google_logging_folder_exclusion","google_logging_folder_sink","google_logging_log_view","google_logging_metric","google_logging_project_bucket_config","google_logging_project_exclusion","google_logging_project_sink","google_memcache_instance","google_ml_engine_model","google_monitoring_alert_policy","google_monitoring_custom_service","google_monitoring_dashboard","google_monitoring_group","google_monitoring_metric_descriptor","google_monitoring_notification_channel","google_monitoring_service","google_monitoring_slo","google_monitoring_uptime_check_config","google_network_connectivity_hub","google_network_connectivity_spoke","google_network_management_connectivity_test","google_notebooks_environment","google_notebooks_instance","google_notebooks_instance_iam_member","google_notebooks_runtime","google_notebooks_runtime_iam_member","google_organization_iam_audit_config","google_organization_iam_custom_role","google_organization_iam_member","google_os_config_os_policy_assignment","google_os_config_patch_deployment","google_os_login_ssh_public_key","google_privateca_ca_pool","google_privateca_ca_pool_iam_member","google_privateca_certificate","google_privateca_certificate_authority","google_privateca_certificate_template","google_privateca_certificate_template_iam_member","google_project","google_project_default_service_accounts","google_project_iam_audit_config","google_project_iam_custom_role","google_project_iam_member","google_project_service","google_project_usage_export_bucket","google_pubsub_lite_reservation","google_pubsub_lite_subscription","google_pubsub_lite_topic","google_pubsub_schema","google_pubsub_subscription","google_pubsub_subscription_iam_member","google_pubsub_topic","google_pubsub_topic_iam_member","google_redis_instance","google_secret_manager_secret","google_secret_manager_secret_iam_member","google_secret_manager_secret_version","google_service_account","google_service_account_iam_member","google_service_account_key","google_service_networking_connection","google_service_networking_peered_dns_domain","google_sourcerepo_repository","google_sourcerepo_repository_iam_member","google_spanner_database","google_spanner_database_iam_member","google_spanner_instance","google_spanner_instance_iam_member","google_sql_database","google_sql_database_instance","google_sql_source_representation_instance","google_sql_ssl_cert","google_sql_user","google_storage_bucket","google_storage_bucket_access_control","google_storage_bucket_acl","google_storage_bucket_iam_member","google_storage_bucket_object","google_storage_default_object_access_control","google_storage_default_object_acl","google_storage_hmac_key","google_storage_notification","google_storage_object_access_control","google_storage_object_acl","google_storage_transfer_agent_pool","google_tags_tag_binding","google_tags_tag_key","google_tags_tag_value","google_tpu_node","google_vertex_ai_dataset","google_vertex_ai_featurestore","google_vertex_ai_featurestore_entitytype","google_vertex_ai_tensorboard","google_vpc_access_connector","google_workflows_workflow"] \ No newline at end of file diff --git a/config/provider.go b/config/provider.go index b3389cab4..1c928c443 100644 --- a/config/provider.go +++ b/config/provider.go @@ -61,6 +61,7 @@ import ( "github.com/upbound/provider-gcp/config/spanner" "github.com/upbound/provider-gcp/config/sql" "github.com/upbound/provider-gcp/config/storage" + "github.com/upbound/provider-gcp/config/tags" "github.com/upbound/provider-gcp/config/tpu" "github.com/upbound/provider-gcp/config/vertexai" "github.com/upbound/provider-gcp/config/vpcaccess" @@ -238,6 +239,7 @@ func GetProvider(_ context.Context, generationProvider bool) (*ujconfig.Provider bigquery.Configure, beyondcorp.Configure, vertexai.Configure, + tags.Configure, tpu.Configure, vpcaccess.Configure, healthcare.Configure, diff --git a/config/tags/config.go b/config/tags/config.go new file mode 100644 index 000000000..2077e1ef6 --- /dev/null +++ b/config/tags/config.go @@ -0,0 +1,33 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: CC0-1.0 + +package tags + +import ( + "github.com/upbound/provider-gcp/config/common" + + "github.com/crossplane/upjet/pkg/config" +) + +// Configure configures individual resources by adding custom +// ResourceConfigurators. +func Configure(p *config.Provider) { + p.AddResourceConfigurator("google_tags_tag_binding", func(r *config.Resource) { + r.UseAsync = true + r.References["tag_value"] = config.Reference{ + TerraformName: "google_tags_tag_value", + Extractor: common.ExtractResourceIDFuncPath, + } + }) + p.AddResourceConfigurator("google_tags_tag_key", func(r *config.Resource) { + r.UseAsync = true + }) + p.AddResourceConfigurator("google_tags_tag_value", func(r *config.Resource) { + r.UseAsync = true + r.References["parent"] = config.Reference{ + TerraformName: "google_tags_tag_key", + Extractor: common.ExtractResourceIDFuncPath, + } + }) +} diff --git a/examples/tags/v1beta1/tagbinding.yaml b/examples/tags/v1beta1/tagbinding.yaml new file mode 100644 index 000000000..8745ddb37 --- /dev/null +++ b/examples/tags/v1beta1/tagbinding.yaml @@ -0,0 +1,50 @@ +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagBinding +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagbinding + upjet.upbound.io/manual-intervention: "The resource requires a real Project number" + labels: + testing.upbound.io/example-name: binding + name: binding +spec: + forProvider: + parent: //cloudresourcemanager.googleapis.com/projects/&{project_number} + tagValueSelector: + matchLabels: + testing.upbound.io/example-name: value + +--- + +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagKey +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagbinding + upjet.upbound.io/manual-intervention: "The resource requires a real Project ID" + labels: + testing.upbound.io/example-name: key + name: key +spec: + forProvider: + description: For keyname resources. + parent: projects/&{project_id} + shortName: keyname + +--- + +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagValue +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagbinding + labels: + testing.upbound.io/example-name: value + name: value +spec: + forProvider: + description: For valuename resources. + parentSelector: + matchLabels: + testing.upbound.io/example-name: key + shortName: valuename diff --git a/examples/tags/v1beta1/tagkey.yaml b/examples/tags/v1beta1/tagkey.yaml new file mode 100644 index 000000000..380bc02b8 --- /dev/null +++ b/examples/tags/v1beta1/tagkey.yaml @@ -0,0 +1,14 @@ +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagKey +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagkey + upjet.upbound.io/manual-intervention: "The resource requires a real Project ID" + labels: + testing.upbound.io/example-name: key + name: key +spec: + forProvider: + description: For keyname resources. + parent: projects/&{project_id} + shortName: keyname diff --git a/examples/tags/v1beta1/tagvalue.yaml b/examples/tags/v1beta1/tagvalue.yaml new file mode 100644 index 000000000..204ac33e4 --- /dev/null +++ b/examples/tags/v1beta1/tagvalue.yaml @@ -0,0 +1,32 @@ +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagValue +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagvalue + labels: + testing.upbound.io/example-name: value + name: value +spec: + forProvider: + description: For valuename resources. + parentSelector: + matchLabels: + testing.upbound.io/example-name: key + shortName: valuename + +--- + +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagKey +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagvalue + upjet.upbound.io/manual-intervention: "The resource requires a real Project ID" + labels: + testing.upbound.io/example-name: key + name: key +spec: + forProvider: + description: For keyname resources. + parent: projects/&{project_id} + shortName: keyname From 9d300dc6a6fb0374fd0d036e7de57b59c4de78a6 Mon Sep 17 00:00:00 2001 From: declement Date: Tue, 9 Jul 2024 18:48:17 +0200 Subject: [PATCH 2/3] chore: regenerate for tags group Signed-off-by: declement --- .../v1beta1/zz_generated.conversion_hubs.go | 16 + apis/tags/v1beta1/zz_generated.deepcopy.go | 714 ++++++++++++++++++ apis/tags/v1beta1/zz_generated.managed.go | 188 +++++ apis/tags/v1beta1/zz_generated.managedlist.go | 35 + apis/tags/v1beta1/zz_generated.resolvers.go | 117 +++ apis/tags/v1beta1/zz_groupversion_info.go | 32 + .../tags/v1beta1/zz_tagbinding_terraformed.go | 129 ++++ apis/tags/v1beta1/zz_tagbinding_types.go | 131 ++++ apis/tags/v1beta1/zz_tagkey_terraformed.go | 129 ++++ apis/tags/v1beta1/zz_tagkey_types.go | 168 +++++ apis/tags/v1beta1/zz_tagvalue_terraformed.go | 129 ++++ apis/tags/v1beta1/zz_tagvalue_types.go | 155 ++++ apis/zz_register.go | 2 + cmd/provider/tags/zz_main.go | 221 ++++++ .../tags/v1beta1/tagbinding.yaml | 64 ++ examples-generated/tags/v1beta1/tagkey.yaml | 13 + examples-generated/tags/v1beta1/tagvalue.yaml | 31 + .../tags/tagbinding/zz_controller.go | 91 +++ .../controller/tags/tagkey/zz_controller.go | 91 +++ .../controller/tags/tagvalue/zz_controller.go | 91 +++ internal/controller/zz_monolith_setup.go | 6 + internal/controller/zz_tags_setup.go | 30 + .../crds/tags.gcp.upbound.io_tagbindings.yaml | 509 +++++++++++++ package/crds/tags.gcp.upbound.io_tagkeys.yaml | 433 +++++++++++ .../crds/tags.gcp.upbound.io_tagvalues.yaml | 536 +++++++++++++ 25 files changed, 4061 insertions(+) create mode 100755 apis/tags/v1beta1/zz_generated.conversion_hubs.go create mode 100644 apis/tags/v1beta1/zz_generated.deepcopy.go create mode 100644 apis/tags/v1beta1/zz_generated.managed.go create mode 100644 apis/tags/v1beta1/zz_generated.managedlist.go create mode 100644 apis/tags/v1beta1/zz_generated.resolvers.go create mode 100755 apis/tags/v1beta1/zz_groupversion_info.go create mode 100755 apis/tags/v1beta1/zz_tagbinding_terraformed.go create mode 100755 apis/tags/v1beta1/zz_tagbinding_types.go create mode 100755 apis/tags/v1beta1/zz_tagkey_terraformed.go create mode 100755 apis/tags/v1beta1/zz_tagkey_types.go create mode 100755 apis/tags/v1beta1/zz_tagvalue_terraformed.go create mode 100755 apis/tags/v1beta1/zz_tagvalue_types.go create mode 100644 cmd/provider/tags/zz_main.go create mode 100644 examples-generated/tags/v1beta1/tagbinding.yaml create mode 100644 examples-generated/tags/v1beta1/tagkey.yaml create mode 100644 examples-generated/tags/v1beta1/tagvalue.yaml create mode 100755 internal/controller/tags/tagbinding/zz_controller.go create mode 100755 internal/controller/tags/tagkey/zz_controller.go create mode 100755 internal/controller/tags/tagvalue/zz_controller.go create mode 100755 internal/controller/zz_tags_setup.go create mode 100644 package/crds/tags.gcp.upbound.io_tagbindings.yaml create mode 100644 package/crds/tags.gcp.upbound.io_tagkeys.yaml create mode 100644 package/crds/tags.gcp.upbound.io_tagvalues.yaml diff --git a/apis/tags/v1beta1/zz_generated.conversion_hubs.go b/apis/tags/v1beta1/zz_generated.conversion_hubs.go new file mode 100755 index 000000000..e9f120919 --- /dev/null +++ b/apis/tags/v1beta1/zz_generated.conversion_hubs.go @@ -0,0 +1,16 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +// Hub marks this type as a conversion hub. +func (tr *TagBinding) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TagKey) Hub() {} + +// Hub marks this type as a conversion hub. +func (tr *TagValue) Hub() {} diff --git a/apis/tags/v1beta1/zz_generated.deepcopy.go b/apis/tags/v1beta1/zz_generated.deepcopy.go new file mode 100644 index 000000000..c302f41f2 --- /dev/null +++ b/apis/tags/v1beta1/zz_generated.deepcopy.go @@ -0,0 +1,714 @@ +//go:build !ignore_autogenerated + +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by controller-gen. DO NOT EDIT. + +package v1beta1 + +import ( + "github.com/crossplane/crossplane-runtime/apis/common/v1" + runtime "k8s.io/apimachinery/pkg/runtime" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagBinding) DeepCopyInto(out *TagBinding) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagBinding. +func (in *TagBinding) DeepCopy() *TagBinding { + if in == nil { + return nil + } + out := new(TagBinding) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TagBinding) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagBindingInitParameters) DeepCopyInto(out *TagBindingInitParameters) { + *out = *in + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.TagValue != nil { + in, out := &in.TagValue, &out.TagValue + *out = new(string) + **out = **in + } + if in.TagValueRef != nil { + in, out := &in.TagValueRef, &out.TagValueRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.TagValueSelector != nil { + in, out := &in.TagValueSelector, &out.TagValueSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagBindingInitParameters. +func (in *TagBindingInitParameters) DeepCopy() *TagBindingInitParameters { + if in == nil { + return nil + } + out := new(TagBindingInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagBindingList) DeepCopyInto(out *TagBindingList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TagBinding, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagBindingList. +func (in *TagBindingList) DeepCopy() *TagBindingList { + if in == nil { + return nil + } + out := new(TagBindingList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TagBindingList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagBindingObservation) DeepCopyInto(out *TagBindingObservation) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.TagValue != nil { + in, out := &in.TagValue, &out.TagValue + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagBindingObservation. +func (in *TagBindingObservation) DeepCopy() *TagBindingObservation { + if in == nil { + return nil + } + out := new(TagBindingObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagBindingParameters) DeepCopyInto(out *TagBindingParameters) { + *out = *in + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.TagValue != nil { + in, out := &in.TagValue, &out.TagValue + *out = new(string) + **out = **in + } + if in.TagValueRef != nil { + in, out := &in.TagValueRef, &out.TagValueRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.TagValueSelector != nil { + in, out := &in.TagValueSelector, &out.TagValueSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagBindingParameters. +func (in *TagBindingParameters) DeepCopy() *TagBindingParameters { + if in == nil { + return nil + } + out := new(TagBindingParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagBindingSpec) DeepCopyInto(out *TagBindingSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) + in.InitProvider.DeepCopyInto(&out.InitProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagBindingSpec. +func (in *TagBindingSpec) DeepCopy() *TagBindingSpec { + if in == nil { + return nil + } + out := new(TagBindingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagBindingStatus) DeepCopyInto(out *TagBindingStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagBindingStatus. +func (in *TagBindingStatus) DeepCopy() *TagBindingStatus { + if in == nil { + return nil + } + out := new(TagBindingStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagKey) DeepCopyInto(out *TagKey) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagKey. +func (in *TagKey) DeepCopy() *TagKey { + if in == nil { + return nil + } + out := new(TagKey) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TagKey) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagKeyInitParameters) DeepCopyInto(out *TagKeyInitParameters) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.Purpose != nil { + in, out := &in.Purpose, &out.Purpose + *out = new(string) + **out = **in + } + if in.PurposeData != nil { + in, out := &in.PurposeData, &out.PurposeData + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.ShortName != nil { + in, out := &in.ShortName, &out.ShortName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagKeyInitParameters. +func (in *TagKeyInitParameters) DeepCopy() *TagKeyInitParameters { + if in == nil { + return nil + } + out := new(TagKeyInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagKeyList) DeepCopyInto(out *TagKeyList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TagKey, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagKeyList. +func (in *TagKeyList) DeepCopy() *TagKeyList { + if in == nil { + return nil + } + out := new(TagKeyList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TagKeyList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagKeyObservation) DeepCopyInto(out *TagKeyObservation) { + *out = *in + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NamespacedName != nil { + in, out := &in.NamespacedName, &out.NamespacedName + *out = new(string) + **out = **in + } + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.Purpose != nil { + in, out := &in.Purpose, &out.Purpose + *out = new(string) + **out = **in + } + if in.PurposeData != nil { + in, out := &in.PurposeData, &out.PurposeData + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.ShortName != nil { + in, out := &in.ShortName, &out.ShortName + *out = new(string) + **out = **in + } + if in.UpdateTime != nil { + in, out := &in.UpdateTime, &out.UpdateTime + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagKeyObservation. +func (in *TagKeyObservation) DeepCopy() *TagKeyObservation { + if in == nil { + return nil + } + out := new(TagKeyObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagKeyParameters) DeepCopyInto(out *TagKeyParameters) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.Purpose != nil { + in, out := &in.Purpose, &out.Purpose + *out = new(string) + **out = **in + } + if in.PurposeData != nil { + in, out := &in.PurposeData, &out.PurposeData + *out = make(map[string]*string, len(*in)) + for key, val := range *in { + var outVal *string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = new(string) + **out = **in + } + (*out)[key] = outVal + } + } + if in.ShortName != nil { + in, out := &in.ShortName, &out.ShortName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagKeyParameters. +func (in *TagKeyParameters) DeepCopy() *TagKeyParameters { + if in == nil { + return nil + } + out := new(TagKeyParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagKeySpec) DeepCopyInto(out *TagKeySpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) + in.InitProvider.DeepCopyInto(&out.InitProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagKeySpec. +func (in *TagKeySpec) DeepCopy() *TagKeySpec { + if in == nil { + return nil + } + out := new(TagKeySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagKeyStatus) DeepCopyInto(out *TagKeyStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagKeyStatus. +func (in *TagKeyStatus) DeepCopy() *TagKeyStatus { + if in == nil { + return nil + } + out := new(TagKeyStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagValue) DeepCopyInto(out *TagValue) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagValue. +func (in *TagValue) DeepCopy() *TagValue { + if in == nil { + return nil + } + out := new(TagValue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TagValue) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagValueInitParameters) DeepCopyInto(out *TagValueInitParameters) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.ParentRef != nil { + in, out := &in.ParentRef, &out.ParentRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ParentSelector != nil { + in, out := &in.ParentSelector, &out.ParentSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.ShortName != nil { + in, out := &in.ShortName, &out.ShortName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagValueInitParameters. +func (in *TagValueInitParameters) DeepCopy() *TagValueInitParameters { + if in == nil { + return nil + } + out := new(TagValueInitParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagValueList) DeepCopyInto(out *TagValueList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TagValue, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagValueList. +func (in *TagValueList) DeepCopy() *TagValueList { + if in == nil { + return nil + } + out := new(TagValueList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TagValueList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagValueObservation) DeepCopyInto(out *TagValueObservation) { + *out = *in + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = new(string) + **out = **in + } + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.NamespacedName != nil { + in, out := &in.NamespacedName, &out.NamespacedName + *out = new(string) + **out = **in + } + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.ShortName != nil { + in, out := &in.ShortName, &out.ShortName + *out = new(string) + **out = **in + } + if in.UpdateTime != nil { + in, out := &in.UpdateTime, &out.UpdateTime + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagValueObservation. +func (in *TagValueObservation) DeepCopy() *TagValueObservation { + if in == nil { + return nil + } + out := new(TagValueObservation) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagValueParameters) DeepCopyInto(out *TagValueParameters) { + *out = *in + if in.Description != nil { + in, out := &in.Description, &out.Description + *out = new(string) + **out = **in + } + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(string) + **out = **in + } + if in.ParentRef != nil { + in, out := &in.ParentRef, &out.ParentRef + *out = new(v1.Reference) + (*in).DeepCopyInto(*out) + } + if in.ParentSelector != nil { + in, out := &in.ParentSelector, &out.ParentSelector + *out = new(v1.Selector) + (*in).DeepCopyInto(*out) + } + if in.ShortName != nil { + in, out := &in.ShortName, &out.ShortName + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagValueParameters. +func (in *TagValueParameters) DeepCopy() *TagValueParameters { + if in == nil { + return nil + } + out := new(TagValueParameters) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagValueSpec) DeepCopyInto(out *TagValueSpec) { + *out = *in + in.ResourceSpec.DeepCopyInto(&out.ResourceSpec) + in.ForProvider.DeepCopyInto(&out.ForProvider) + in.InitProvider.DeepCopyInto(&out.InitProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagValueSpec. +func (in *TagValueSpec) DeepCopy() *TagValueSpec { + if in == nil { + return nil + } + out := new(TagValueSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TagValueStatus) DeepCopyInto(out *TagValueStatus) { + *out = *in + in.ResourceStatus.DeepCopyInto(&out.ResourceStatus) + in.AtProvider.DeepCopyInto(&out.AtProvider) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TagValueStatus. +func (in *TagValueStatus) DeepCopy() *TagValueStatus { + if in == nil { + return nil + } + out := new(TagValueStatus) + in.DeepCopyInto(out) + return out +} diff --git a/apis/tags/v1beta1/zz_generated.managed.go b/apis/tags/v1beta1/zz_generated.managed.go new file mode 100644 index 000000000..7c301b957 --- /dev/null +++ b/apis/tags/v1beta1/zz_generated.managed.go @@ -0,0 +1,188 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by angryjet. DO NOT EDIT. + +package v1beta1 + +import xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + +// GetCondition of this TagBinding. +func (mg *TagBinding) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this TagBinding. +func (mg *TagBinding) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this TagBinding. +func (mg *TagBinding) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this TagBinding. +func (mg *TagBinding) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetPublishConnectionDetailsTo of this TagBinding. +func (mg *TagBinding) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this TagBinding. +func (mg *TagBinding) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this TagBinding. +func (mg *TagBinding) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this TagBinding. +func (mg *TagBinding) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this TagBinding. +func (mg *TagBinding) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this TagBinding. +func (mg *TagBinding) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetPublishConnectionDetailsTo of this TagBinding. +func (mg *TagBinding) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this TagBinding. +func (mg *TagBinding) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} + +// GetCondition of this TagKey. +func (mg *TagKey) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this TagKey. +func (mg *TagKey) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this TagKey. +func (mg *TagKey) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this TagKey. +func (mg *TagKey) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetPublishConnectionDetailsTo of this TagKey. +func (mg *TagKey) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this TagKey. +func (mg *TagKey) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this TagKey. +func (mg *TagKey) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this TagKey. +func (mg *TagKey) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this TagKey. +func (mg *TagKey) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this TagKey. +func (mg *TagKey) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetPublishConnectionDetailsTo of this TagKey. +func (mg *TagKey) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this TagKey. +func (mg *TagKey) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} + +// GetCondition of this TagValue. +func (mg *TagValue) GetCondition(ct xpv1.ConditionType) xpv1.Condition { + return mg.Status.GetCondition(ct) +} + +// GetDeletionPolicy of this TagValue. +func (mg *TagValue) GetDeletionPolicy() xpv1.DeletionPolicy { + return mg.Spec.DeletionPolicy +} + +// GetManagementPolicies of this TagValue. +func (mg *TagValue) GetManagementPolicies() xpv1.ManagementPolicies { + return mg.Spec.ManagementPolicies +} + +// GetProviderConfigReference of this TagValue. +func (mg *TagValue) GetProviderConfigReference() *xpv1.Reference { + return mg.Spec.ProviderConfigReference +} + +// GetPublishConnectionDetailsTo of this TagValue. +func (mg *TagValue) GetPublishConnectionDetailsTo() *xpv1.PublishConnectionDetailsTo { + return mg.Spec.PublishConnectionDetailsTo +} + +// GetWriteConnectionSecretToReference of this TagValue. +func (mg *TagValue) GetWriteConnectionSecretToReference() *xpv1.SecretReference { + return mg.Spec.WriteConnectionSecretToReference +} + +// SetConditions of this TagValue. +func (mg *TagValue) SetConditions(c ...xpv1.Condition) { + mg.Status.SetConditions(c...) +} + +// SetDeletionPolicy of this TagValue. +func (mg *TagValue) SetDeletionPolicy(r xpv1.DeletionPolicy) { + mg.Spec.DeletionPolicy = r +} + +// SetManagementPolicies of this TagValue. +func (mg *TagValue) SetManagementPolicies(r xpv1.ManagementPolicies) { + mg.Spec.ManagementPolicies = r +} + +// SetProviderConfigReference of this TagValue. +func (mg *TagValue) SetProviderConfigReference(r *xpv1.Reference) { + mg.Spec.ProviderConfigReference = r +} + +// SetPublishConnectionDetailsTo of this TagValue. +func (mg *TagValue) SetPublishConnectionDetailsTo(r *xpv1.PublishConnectionDetailsTo) { + mg.Spec.PublishConnectionDetailsTo = r +} + +// SetWriteConnectionSecretToReference of this TagValue. +func (mg *TagValue) SetWriteConnectionSecretToReference(r *xpv1.SecretReference) { + mg.Spec.WriteConnectionSecretToReference = r +} diff --git a/apis/tags/v1beta1/zz_generated.managedlist.go b/apis/tags/v1beta1/zz_generated.managedlist.go new file mode 100644 index 000000000..3dfa5b67e --- /dev/null +++ b/apis/tags/v1beta1/zz_generated.managedlist.go @@ -0,0 +1,35 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by angryjet. DO NOT EDIT. + +package v1beta1 + +import resource "github.com/crossplane/crossplane-runtime/pkg/resource" + +// GetItems of this TagBindingList. +func (l *TagBindingList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + +// GetItems of this TagKeyList. +func (l *TagKeyList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} + +// GetItems of this TagValueList. +func (l *TagValueList) GetItems() []resource.Managed { + items := make([]resource.Managed, len(l.Items)) + for i := range l.Items { + items[i] = &l.Items[i] + } + return items +} diff --git a/apis/tags/v1beta1/zz_generated.resolvers.go b/apis/tags/v1beta1/zz_generated.resolvers.go new file mode 100644 index 000000000..005a22538 --- /dev/null +++ b/apis/tags/v1beta1/zz_generated.resolvers.go @@ -0,0 +1,117 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 +// Code generated by angryjet. DO NOT EDIT. +// Code transformed by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "context" + reference "github.com/crossplane/crossplane-runtime/pkg/reference" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + errors "github.com/pkg/errors" + common "github.com/upbound/provider-gcp/config/common" + apisresolver "github.com/upbound/provider-gcp/internal/apis" + client "sigs.k8s.io/controller-runtime/pkg/client" +) + +func (mg *TagBinding) ResolveReferences( // ResolveReferences of this TagBinding. + ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + { + m, l, err = apisresolver.GetManagedResource("tags.gcp.upbound.io", "v1beta1", "TagValue", "TagValueList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.TagValue), + Extract: common.ExtractResourceID(), + Reference: mg.Spec.ForProvider.TagValueRef, + Selector: mg.Spec.ForProvider.TagValueSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.TagValue") + } + mg.Spec.ForProvider.TagValue = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.TagValueRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("tags.gcp.upbound.io", "v1beta1", "TagValue", "TagValueList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.TagValue), + Extract: common.ExtractResourceID(), + Reference: mg.Spec.InitProvider.TagValueRef, + Selector: mg.Spec.InitProvider.TagValueSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.TagValue") + } + mg.Spec.InitProvider.TagValue = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.TagValueRef = rsp.ResolvedReference + + return nil +} + +// ResolveReferences of this TagValue. +func (mg *TagValue) ResolveReferences(ctx context.Context, c client.Reader) error { + var m xpresource.Managed + var l xpresource.ManagedList + r := reference.NewAPIResolver(c, mg) + + var rsp reference.ResolutionResponse + var err error + { + m, l, err = apisresolver.GetManagedResource("tags.gcp.upbound.io", "v1beta1", "TagKey", "TagKeyList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Parent), + Extract: common.ExtractResourceID(), + Reference: mg.Spec.ForProvider.ParentRef, + Selector: mg.Spec.ForProvider.ParentSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.ForProvider.Parent") + } + mg.Spec.ForProvider.Parent = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.ForProvider.ParentRef = rsp.ResolvedReference + { + m, l, err = apisresolver.GetManagedResource("tags.gcp.upbound.io", "v1beta1", "TagKey", "TagKeyList") + if err != nil { + return errors.Wrap(err, "failed to get the reference target managed resource and its list for reference resolution") + } + + rsp, err = r.Resolve(ctx, reference.ResolutionRequest{ + CurrentValue: reference.FromPtrValue(mg.Spec.InitProvider.Parent), + Extract: common.ExtractResourceID(), + Reference: mg.Spec.InitProvider.ParentRef, + Selector: mg.Spec.InitProvider.ParentSelector, + To: reference.To{List: l, Managed: m}, + }) + } + if err != nil { + return errors.Wrap(err, "mg.Spec.InitProvider.Parent") + } + mg.Spec.InitProvider.Parent = reference.ToPtrValue(rsp.ResolvedValue) + mg.Spec.InitProvider.ParentRef = rsp.ResolvedReference + + return nil +} diff --git a/apis/tags/v1beta1/zz_groupversion_info.go b/apis/tags/v1beta1/zz_groupversion_info.go new file mode 100755 index 000000000..b85c106ad --- /dev/null +++ b/apis/tags/v1beta1/zz_groupversion_info.go @@ -0,0 +1,32 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +// +kubebuilder:object:generate=true +// +groupName=tags.gcp.upbound.io +// +versionName=v1beta1 +package v1beta1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "sigs.k8s.io/controller-runtime/pkg/scheme" +) + +// Package type metadata. +const ( + CRDGroup = "tags.gcp.upbound.io" + CRDVersion = "v1beta1" +) + +var ( + // CRDGroupVersion is the API Group Version used to register the objects + CRDGroupVersion = schema.GroupVersion{Group: CRDGroup, Version: CRDVersion} + + // SchemeBuilder is used to add go types to the GroupVersionKind scheme + SchemeBuilder = &scheme.Builder{GroupVersion: CRDGroupVersion} + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = SchemeBuilder.AddToScheme +) diff --git a/apis/tags/v1beta1/zz_tagbinding_terraformed.go b/apis/tags/v1beta1/zz_tagbinding_terraformed.go new file mode 100755 index 000000000..0768c5191 --- /dev/null +++ b/apis/tags/v1beta1/zz_tagbinding_terraformed.go @@ -0,0 +1,129 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TagBinding +func (mg *TagBinding) GetTerraformResourceType() string { + return "google_tags_tag_binding" +} + +// GetConnectionDetailsMapping for this TagBinding +func (tr *TagBinding) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TagBinding +func (tr *TagBinding) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TagBinding +func (tr *TagBinding) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TagBinding +func (tr *TagBinding) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TagBinding +func (tr *TagBinding) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TagBinding +func (tr *TagBinding) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TagBinding +func (tr *TagBinding) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TagBinding +func (tr *TagBinding) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TagBinding using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TagBinding) LateInitialize(attrs []byte) (bool, error) { + params := &TagBindingParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TagBinding) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/tags/v1beta1/zz_tagbinding_types.go b/apis/tags/v1beta1/zz_tagbinding_types.go new file mode 100755 index 000000000..90ce11da8 --- /dev/null +++ b/apis/tags/v1beta1/zz_tagbinding_types.go @@ -0,0 +1,131 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type TagBindingInitParameters struct { + + // The full resource name of the resource the TagValue is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123 + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // The TagValue of the TagBinding. Must be of the form tagValues/456. + // +crossplane:generate:reference:type=github.com/upbound/provider-gcp/apis/tags/v1beta1.TagValue + // +crossplane:generate:reference:extractor=github.com/upbound/provider-gcp/config/common.ExtractResourceID() + TagValue *string `json:"tagValue,omitempty" tf:"tag_value,omitempty"` + + // Reference to a TagValue in tags to populate tagValue. + // +kubebuilder:validation:Optional + TagValueRef *v1.Reference `json:"tagValueRef,omitempty" tf:"-"` + + // Selector for a TagValue in tags to populate tagValue. + // +kubebuilder:validation:Optional + TagValueSelector *v1.Selector `json:"tagValueSelector,omitempty" tf:"-"` +} + +type TagBindingObservation struct { + + // an identifier for the resource with format tagBindings/{{name}} + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // The generated id for the TagBinding. This is a string of the form: tagBindings/{full-resource-name}/{tag-value-name} + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // The full resource name of the resource the TagValue is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123 + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // The TagValue of the TagBinding. Must be of the form tagValues/456. + TagValue *string `json:"tagValue,omitempty" tf:"tag_value,omitempty"` +} + +type TagBindingParameters struct { + + // The full resource name of the resource the TagValue is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123 + // +kubebuilder:validation:Optional + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // The TagValue of the TagBinding. Must be of the form tagValues/456. + // +crossplane:generate:reference:type=github.com/upbound/provider-gcp/apis/tags/v1beta1.TagValue + // +crossplane:generate:reference:extractor=github.com/upbound/provider-gcp/config/common.ExtractResourceID() + // +kubebuilder:validation:Optional + TagValue *string `json:"tagValue,omitempty" tf:"tag_value,omitempty"` + + // Reference to a TagValue in tags to populate tagValue. + // +kubebuilder:validation:Optional + TagValueRef *v1.Reference `json:"tagValueRef,omitempty" tf:"-"` + + // Selector for a TagValue in tags to populate tagValue. + // +kubebuilder:validation:Optional + TagValueSelector *v1.Selector `json:"tagValueSelector,omitempty" tf:"-"` +} + +// TagBindingSpec defines the desired state of TagBinding +type TagBindingSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider TagBindingParameters `json:"forProvider"` + // THIS IS A BETA FIELD. It will be honored + // unless the Management Policies feature flag is disabled. + // InitProvider holds the same fields as ForProvider, with the exception + // of Identifier and other resource reference fields. The fields that are + // in InitProvider are merged into ForProvider when the resource is created. + // The same fields are also added to the terraform ignore_changes hook, to + // avoid updating them after creation. This is useful for fields that are + // required on creation, but we do not desire to update them after creation, + // for example because of an external controller is managing them, like an + // autoscaler. + InitProvider TagBindingInitParameters `json:"initProvider,omitempty"` +} + +// TagBindingStatus defines the observed state of TagBinding. +type TagBindingStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider TagBindingObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// TagBinding is the Schema for the TagBindings API. A TagBinding represents a connection between a TagValue and a cloud resource (currently project, folder, or organization). +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,gcp} +type TagBinding struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.parent) || (has(self.initProvider) && has(self.initProvider.parent))",message="spec.forProvider.parent is a required parameter" + Spec TagBindingSpec `json:"spec"` + Status TagBindingStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// TagBindingList contains a list of TagBindings +type TagBindingList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TagBinding `json:"items"` +} + +// Repository type metadata. +var ( + TagBinding_Kind = "TagBinding" + TagBinding_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: TagBinding_Kind}.String() + TagBinding_KindAPIVersion = TagBinding_Kind + "." + CRDGroupVersion.String() + TagBinding_GroupVersionKind = CRDGroupVersion.WithKind(TagBinding_Kind) +) + +func init() { + SchemeBuilder.Register(&TagBinding{}, &TagBindingList{}) +} diff --git a/apis/tags/v1beta1/zz_tagkey_terraformed.go b/apis/tags/v1beta1/zz_tagkey_terraformed.go new file mode 100755 index 000000000..7232db710 --- /dev/null +++ b/apis/tags/v1beta1/zz_tagkey_terraformed.go @@ -0,0 +1,129 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TagKey +func (mg *TagKey) GetTerraformResourceType() string { + return "google_tags_tag_key" +} + +// GetConnectionDetailsMapping for this TagKey +func (tr *TagKey) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TagKey +func (tr *TagKey) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TagKey +func (tr *TagKey) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TagKey +func (tr *TagKey) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TagKey +func (tr *TagKey) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TagKey +func (tr *TagKey) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TagKey +func (tr *TagKey) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TagKey +func (tr *TagKey) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TagKey using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TagKey) LateInitialize(attrs []byte) (bool, error) { + params := &TagKeyParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TagKey) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/tags/v1beta1/zz_tagkey_types.go b/apis/tags/v1beta1/zz_tagkey_types.go new file mode 100755 index 000000000..0ea6f8390 --- /dev/null +++ b/apis/tags/v1beta1/zz_tagkey_types.go @@ -0,0 +1,168 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type TagKeyInitParameters struct { + + // User-assigned description of the TagKey. Must not exceed 256 characters. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // Input only. The resource name of the new TagKey's parent. Must be of the form organizations/{org_id} or projects/{project_id_or_number}. + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // Optional. A purpose cannot be changed once set. + // A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. + // Possible values are: GCE_FIREWALL. + Purpose *string `json:"purpose,omitempty" tf:"purpose,omitempty"` + + // Optional. Purpose data cannot be changed once set. + // Purpose data corresponds to the policy system that the tag is intended for. For example, the GCE_FIREWALL purpose expects data in the following format: network = "/". + // +mapType=granular + PurposeData map[string]*string `json:"purposeData,omitempty" tf:"purpose_data,omitempty"` + + // Input only. The user friendly name for a TagKey. The short name should be unique for TagKeys within the same tag namespace. + // The short name must be 1-63 characters, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + ShortName *string `json:"shortName,omitempty" tf:"short_name,omitempty"` +} + +type TagKeyObservation struct { + + // Output only. Creation time. + // A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". + CreateTime *string `json:"createTime,omitempty" tf:"create_time,omitempty"` + + // User-assigned description of the TagKey. Must not exceed 256 characters. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // an identifier for the resource with format tagKeys/{{name}} + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // The generated numeric id for the TagKey. + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // Output only. Namespaced name of the TagKey. + NamespacedName *string `json:"namespacedName,omitempty" tf:"namespaced_name,omitempty"` + + // Input only. The resource name of the new TagKey's parent. Must be of the form organizations/{org_id} or projects/{project_id_or_number}. + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // Optional. A purpose cannot be changed once set. + // A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. + // Possible values are: GCE_FIREWALL. + Purpose *string `json:"purpose,omitempty" tf:"purpose,omitempty"` + + // Optional. Purpose data cannot be changed once set. + // Purpose data corresponds to the policy system that the tag is intended for. For example, the GCE_FIREWALL purpose expects data in the following format: network = "/". + // +mapType=granular + PurposeData map[string]*string `json:"purposeData,omitempty" tf:"purpose_data,omitempty"` + + // Input only. The user friendly name for a TagKey. The short name should be unique for TagKeys within the same tag namespace. + // The short name must be 1-63 characters, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + ShortName *string `json:"shortName,omitempty" tf:"short_name,omitempty"` + + // Output only. Update time. + // A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". + UpdateTime *string `json:"updateTime,omitempty" tf:"update_time,omitempty"` +} + +type TagKeyParameters struct { + + // User-assigned description of the TagKey. Must not exceed 256 characters. + // +kubebuilder:validation:Optional + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // Input only. The resource name of the new TagKey's parent. Must be of the form organizations/{org_id} or projects/{project_id_or_number}. + // +kubebuilder:validation:Optional + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // Optional. A purpose cannot be changed once set. + // A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. + // Possible values are: GCE_FIREWALL. + // +kubebuilder:validation:Optional + Purpose *string `json:"purpose,omitempty" tf:"purpose,omitempty"` + + // Optional. Purpose data cannot be changed once set. + // Purpose data corresponds to the policy system that the tag is intended for. For example, the GCE_FIREWALL purpose expects data in the following format: network = "/". + // +kubebuilder:validation:Optional + // +mapType=granular + PurposeData map[string]*string `json:"purposeData,omitempty" tf:"purpose_data,omitempty"` + + // Input only. The user friendly name for a TagKey. The short name should be unique for TagKeys within the same tag namespace. + // The short name must be 1-63 characters, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + // +kubebuilder:validation:Optional + ShortName *string `json:"shortName,omitempty" tf:"short_name,omitempty"` +} + +// TagKeySpec defines the desired state of TagKey +type TagKeySpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider TagKeyParameters `json:"forProvider"` + // THIS IS A BETA FIELD. It will be honored + // unless the Management Policies feature flag is disabled. + // InitProvider holds the same fields as ForProvider, with the exception + // of Identifier and other resource reference fields. The fields that are + // in InitProvider are merged into ForProvider when the resource is created. + // The same fields are also added to the terraform ignore_changes hook, to + // avoid updating them after creation. This is useful for fields that are + // required on creation, but we do not desire to update them after creation, + // for example because of an external controller is managing them, like an + // autoscaler. + InitProvider TagKeyInitParameters `json:"initProvider,omitempty"` +} + +// TagKeyStatus defines the observed state of TagKey. +type TagKeyStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider TagKeyObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// TagKey is the Schema for the TagKeys API. A TagKey, used to group a set of TagValues. +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,gcp} +type TagKey struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.parent) || (has(self.initProvider) && has(self.initProvider.parent))",message="spec.forProvider.parent is a required parameter" + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.shortName) || (has(self.initProvider) && has(self.initProvider.shortName))",message="spec.forProvider.shortName is a required parameter" + Spec TagKeySpec `json:"spec"` + Status TagKeyStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// TagKeyList contains a list of TagKeys +type TagKeyList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TagKey `json:"items"` +} + +// Repository type metadata. +var ( + TagKey_Kind = "TagKey" + TagKey_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: TagKey_Kind}.String() + TagKey_KindAPIVersion = TagKey_Kind + "." + CRDGroupVersion.String() + TagKey_GroupVersionKind = CRDGroupVersion.WithKind(TagKey_Kind) +) + +func init() { + SchemeBuilder.Register(&TagKey{}, &TagKeyList{}) +} diff --git a/apis/tags/v1beta1/zz_tagvalue_terraformed.go b/apis/tags/v1beta1/zz_tagvalue_terraformed.go new file mode 100755 index 000000000..5495ce654 --- /dev/null +++ b/apis/tags/v1beta1/zz_tagvalue_terraformed.go @@ -0,0 +1,129 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + "dario.cat/mergo" + "github.com/pkg/errors" + + "github.com/crossplane/upjet/pkg/resource" + "github.com/crossplane/upjet/pkg/resource/json" +) + +// GetTerraformResourceType returns Terraform resource type for this TagValue +func (mg *TagValue) GetTerraformResourceType() string { + return "google_tags_tag_value" +} + +// GetConnectionDetailsMapping for this TagValue +func (tr *TagValue) GetConnectionDetailsMapping() map[string]string { + return nil +} + +// GetObservation of this TagValue +func (tr *TagValue) GetObservation() (map[string]any, error) { + o, err := json.TFParser.Marshal(tr.Status.AtProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(o, &base) +} + +// SetObservation for this TagValue +func (tr *TagValue) SetObservation(obs map[string]any) error { + p, err := json.TFParser.Marshal(obs) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Status.AtProvider) +} + +// GetID returns ID of underlying Terraform resource of this TagValue +func (tr *TagValue) GetID() string { + if tr.Status.AtProvider.ID == nil { + return "" + } + return *tr.Status.AtProvider.ID +} + +// GetParameters of this TagValue +func (tr *TagValue) GetParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.ForProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// SetParameters for this TagValue +func (tr *TagValue) SetParameters(params map[string]any) error { + p, err := json.TFParser.Marshal(params) + if err != nil { + return err + } + return json.TFParser.Unmarshal(p, &tr.Spec.ForProvider) +} + +// GetInitParameters of this TagValue +func (tr *TagValue) GetInitParameters() (map[string]any, error) { + p, err := json.TFParser.Marshal(tr.Spec.InitProvider) + if err != nil { + return nil, err + } + base := map[string]any{} + return base, json.TFParser.Unmarshal(p, &base) +} + +// GetInitParameters of this TagValue +func (tr *TagValue) GetMergedParameters(shouldMergeInitProvider bool) (map[string]any, error) { + params, err := tr.GetParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get parameters for resource '%q'", tr.GetName()) + } + if !shouldMergeInitProvider { + return params, nil + } + + initParams, err := tr.GetInitParameters() + if err != nil { + return nil, errors.Wrapf(err, "cannot get init parameters for resource '%q'", tr.GetName()) + } + + // Note(lsviben): mergo.WithSliceDeepCopy is needed to merge the + // slices from the initProvider to forProvider. As it also sets + // overwrite to true, we need to set it back to false, we don't + // want to overwrite the forProvider fields with the initProvider + // fields. + err = mergo.Merge(¶ms, initParams, mergo.WithSliceDeepCopy, func(c *mergo.Config) { + c.Overwrite = false + }) + if err != nil { + return nil, errors.Wrapf(err, "cannot merge spec.initProvider and spec.forProvider parameters for resource '%q'", tr.GetName()) + } + + return params, nil +} + +// LateInitialize this TagValue using its observed tfState. +// returns True if there are any spec changes for the resource. +func (tr *TagValue) LateInitialize(attrs []byte) (bool, error) { + params := &TagValueParameters{} + if err := json.TFParser.Unmarshal(attrs, params); err != nil { + return false, errors.Wrap(err, "failed to unmarshal Terraform state parameters for late-initialization") + } + opts := []resource.GenericLateInitializerOption{resource.WithZeroValueJSONOmitEmptyFilter(resource.CNameWildcard)} + + li := resource.NewGenericLateInitializer(opts...) + return li.LateInitialize(&tr.Spec.ForProvider, params) +} + +// GetTerraformSchemaVersion returns the associated Terraform schema version +func (tr *TagValue) GetTerraformSchemaVersion() int { + return 0 +} diff --git a/apis/tags/v1beta1/zz_tagvalue_types.go b/apis/tags/v1beta1/zz_tagvalue_types.go new file mode 100755 index 000000000..1cfc768e8 --- /dev/null +++ b/apis/tags/v1beta1/zz_tagvalue_types.go @@ -0,0 +1,155 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package v1beta1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" + + v1 "github.com/crossplane/crossplane-runtime/apis/common/v1" +) + +type TagValueInitParameters struct { + + // User-assigned description of the TagValue. Must not exceed 256 characters. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}. + // +crossplane:generate:reference:type=github.com/upbound/provider-gcp/apis/tags/v1beta1.TagKey + // +crossplane:generate:reference:extractor=github.com/upbound/provider-gcp/config/common.ExtractResourceID() + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // Reference to a TagKey in tags to populate parent. + // +kubebuilder:validation:Optional + ParentRef *v1.Reference `json:"parentRef,omitempty" tf:"-"` + + // Selector for a TagKey in tags to populate parent. + // +kubebuilder:validation:Optional + ParentSelector *v1.Selector `json:"parentSelector,omitempty" tf:"-"` + + // Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey. + // The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + ShortName *string `json:"shortName,omitempty" tf:"short_name,omitempty"` +} + +type TagValueObservation struct { + + // Output only. Creation time. + // A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". + CreateTime *string `json:"createTime,omitempty" tf:"create_time,omitempty"` + + // User-assigned description of the TagValue. Must not exceed 256 characters. + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // an identifier for the resource with format tagValues/{{name}} + ID *string `json:"id,omitempty" tf:"id,omitempty"` + + // The generated numeric id for the TagValue. + Name *string `json:"name,omitempty" tf:"name,omitempty"` + + // Output only. Namespaced name of the TagValue. Will be in the format {parentNamespace}/{tagKeyShortName}/{shortName}. + NamespacedName *string `json:"namespacedName,omitempty" tf:"namespaced_name,omitempty"` + + // Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}. + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey. + // The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + ShortName *string `json:"shortName,omitempty" tf:"short_name,omitempty"` + + // Output only. Update time. + // A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". + UpdateTime *string `json:"updateTime,omitempty" tf:"update_time,omitempty"` +} + +type TagValueParameters struct { + + // User-assigned description of the TagValue. Must not exceed 256 characters. + // +kubebuilder:validation:Optional + Description *string `json:"description,omitempty" tf:"description,omitempty"` + + // Input only. The resource name of the new TagValue's parent. Must be of the form tagKeys/{tag_key_id}. + // +crossplane:generate:reference:type=github.com/upbound/provider-gcp/apis/tags/v1beta1.TagKey + // +crossplane:generate:reference:extractor=github.com/upbound/provider-gcp/config/common.ExtractResourceID() + // +kubebuilder:validation:Optional + Parent *string `json:"parent,omitempty" tf:"parent,omitempty"` + + // Reference to a TagKey in tags to populate parent. + // +kubebuilder:validation:Optional + ParentRef *v1.Reference `json:"parentRef,omitempty" tf:"-"` + + // Selector for a TagKey in tags to populate parent. + // +kubebuilder:validation:Optional + ParentSelector *v1.Selector `json:"parentSelector,omitempty" tf:"-"` + + // Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey. + // The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + // +kubebuilder:validation:Optional + ShortName *string `json:"shortName,omitempty" tf:"short_name,omitempty"` +} + +// TagValueSpec defines the desired state of TagValue +type TagValueSpec struct { + v1.ResourceSpec `json:",inline"` + ForProvider TagValueParameters `json:"forProvider"` + // THIS IS A BETA FIELD. It will be honored + // unless the Management Policies feature flag is disabled. + // InitProvider holds the same fields as ForProvider, with the exception + // of Identifier and other resource reference fields. The fields that are + // in InitProvider are merged into ForProvider when the resource is created. + // The same fields are also added to the terraform ignore_changes hook, to + // avoid updating them after creation. This is useful for fields that are + // required on creation, but we do not desire to update them after creation, + // for example because of an external controller is managing them, like an + // autoscaler. + InitProvider TagValueInitParameters `json:"initProvider,omitempty"` +} + +// TagValueStatus defines the observed state of TagValue. +type TagValueStatus struct { + v1.ResourceStatus `json:",inline"` + AtProvider TagValueObservation `json:"atProvider,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// TagValue is the Schema for the TagValues API. A TagValue is a child of a particular TagKey. +// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status" +// +kubebuilder:printcolumn:name="READY",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" +// +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,gcp} +type TagValue struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + // +kubebuilder:validation:XValidation:rule="!('*' in self.managementPolicies || 'Create' in self.managementPolicies || 'Update' in self.managementPolicies) || has(self.forProvider.shortName) || (has(self.initProvider) && has(self.initProvider.shortName))",message="spec.forProvider.shortName is a required parameter" + Spec TagValueSpec `json:"spec"` + Status TagValueStatus `json:"status,omitempty"` +} + +// +kubebuilder:object:root=true + +// TagValueList contains a list of TagValues +type TagValueList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TagValue `json:"items"` +} + +// Repository type metadata. +var ( + TagValue_Kind = "TagValue" + TagValue_GroupKind = schema.GroupKind{Group: CRDGroup, Kind: TagValue_Kind}.String() + TagValue_KindAPIVersion = TagValue_Kind + "." + CRDGroupVersion.String() + TagValue_GroupVersionKind = CRDGroupVersion.WithKind(TagValue_Kind) +) + +func init() { + SchemeBuilder.Register(&TagValue{}, &TagValueList{}) +} diff --git a/apis/zz_register.go b/apis/zz_register.go index 9650c6226..3e95ce170 100755 --- a/apis/zz_register.go +++ b/apis/zz_register.go @@ -136,6 +136,7 @@ import ( v1beta2storage "github.com/upbound/provider-gcp/apis/storage/v1beta2" v1beta1storagetransfer "github.com/upbound/provider-gcp/apis/storagetransfer/v1beta1" v1beta2storagetransfer "github.com/upbound/provider-gcp/apis/storagetransfer/v1beta2" + v1beta1tags "github.com/upbound/provider-gcp/apis/tags/v1beta1" v1beta1tpu "github.com/upbound/provider-gcp/apis/tpu/v1beta1" v1beta2tpu "github.com/upbound/provider-gcp/apis/tpu/v1beta2" v1alpha1 "github.com/upbound/provider-gcp/apis/v1alpha1" @@ -276,6 +277,7 @@ func init() { v1beta2storage.SchemeBuilder.AddToScheme, v1beta1storagetransfer.SchemeBuilder.AddToScheme, v1beta2storagetransfer.SchemeBuilder.AddToScheme, + v1beta1tags.SchemeBuilder.AddToScheme, v1beta1tpu.SchemeBuilder.AddToScheme, v1beta2tpu.SchemeBuilder.AddToScheme, v1alpha1.SchemeBuilder.AddToScheme, diff --git a/cmd/provider/tags/zz_main.go b/cmd/provider/tags/zz_main.go new file mode 100644 index 000000000..c1d82a2f3 --- /dev/null +++ b/cmd/provider/tags/zz_main.go @@ -0,0 +1,221 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +package main + +import ( + "context" + "fmt" + "io" + "log" + "os" + "path/filepath" + "time" + + xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1" + "github.com/crossplane/crossplane-runtime/pkg/certificates" + xpcontroller "github.com/crossplane/crossplane-runtime/pkg/controller" + "github.com/crossplane/crossplane-runtime/pkg/feature" + "github.com/crossplane/crossplane-runtime/pkg/logging" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/conversion" + "gopkg.in/alecthomas/kingpin.v2" + kerrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" + "k8s.io/client-go/tools/leaderelection/resourcelock" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/cache" + "sigs.k8s.io/controller-runtime/pkg/log/zap" + "sigs.k8s.io/controller-runtime/pkg/metrics" + "sigs.k8s.io/controller-runtime/pkg/webhook" + + "github.com/upbound/provider-gcp/apis" + "github.com/upbound/provider-gcp/apis/v1alpha1" + "github.com/upbound/provider-gcp/config" + resolverapis "github.com/upbound/provider-gcp/internal/apis" + "github.com/upbound/provider-gcp/internal/clients" + "github.com/upbound/provider-gcp/internal/controller" + "github.com/upbound/provider-gcp/internal/features" +) + +const ( + webhookTLSCertDirEnvVar = "WEBHOOK_TLS_CERT_DIR" + tlsServerCertDirEnvVar = "TLS_SERVER_CERTS_DIR" + certsDirEnvVar = "CERTS_DIR" + tlsServerCertDir = "/tls/server" +) + +func deprecationAction(flagName string) kingpin.Action { + return func(c *kingpin.ParseContext) error { + _, err := fmt.Fprintf(os.Stderr, "warning: Command-line flag %q is deprecated and no longer used. It will be removed in a future release. Please remove it from all of your configurations (ControllerConfigs, etc.).\n", flagName) + kingpin.FatalIfError(err, "Failed to print the deprecation notice.") + return nil + } +} + +func main() { + var ( + app = kingpin.New(filepath.Base(os.Args[0]), "Terraform based Crossplane provider for GCP").DefaultEnvars() + debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool() + syncInterval = app.Flag("sync", "Sync interval controls how often all resources will be double checked for drift.").Short('s').Default("1h").Duration() + pollInterval = app.Flag("poll", "Poll interval controls how often an individual resource should be checked for drift.").Default("10m").Duration() + pollStateMetricInterval = app.Flag("poll-state-metric", "State metric recording interval").Default("5s").Duration() + leaderElection = app.Flag("leader-election", "Use leader election for the controller manager.").Short('l').Default("false").OverrideDefaultFromEnvar("LEADER_ELECTION").Bool() + maxReconcileRate = app.Flag("max-reconcile-rate", "The global maximum rate per second at which resources may checked for drift from the desired state.").Default("100").Int() + + namespace = app.Flag("namespace", "Namespace used to set as default scope in default secret store config.").Default("crossplane-system").Envar("POD_NAMESPACE").String() + essTLSCertsPath = app.Flag("ess-tls-cert-dir", "Path of ESS TLS certificates.").Envar("ESS_TLS_CERTS_DIR").String() + enableExternalSecretStores = app.Flag("enable-external-secret-stores", "Enable support for ExternalSecretStores.").Default("false").Envar("ENABLE_EXTERNAL_SECRET_STORES").Bool() + enableManagementPolicies = app.Flag("enable-management-policies", "Enable support for Management Policies.").Default("true").Envar("ENABLE_MANAGEMENT_POLICIES").Bool() + + certsDirSet = false + // we record whether the command-line option "--certs-dir" was supplied + // in the registered PreAction for the flag. + certsDir = app.Flag("certs-dir", "The directory that contains the server key and certificate.").Default(tlsServerCertDir).Envar(certsDirEnvVar).PreAction(func(_ *kingpin.ParseContext) error { + certsDirSet = true + return nil + }).String() + + // now deprecated command-line arguments with the Terraform SDK-based upjet architecture + _ = app.Flag("provider-ttl", "[DEPRECATED: This option is no longer used and it will be removed in a future release.] TTL for the native plugin processes before they are replaced. Changing the default may increase memory consumption.").Hidden().Action(deprecationAction("provider-ttl")).Int() + _ = app.Flag("terraform-version", "[DEPRECATED: This option is no longer used and it will be removed in a future release.] Terraform version.").Envar("TERRAFORM_VERSION").Hidden().Action(deprecationAction("terraform-version")).String() + _ = app.Flag("terraform-provider-version", "[DEPRECATED: This option is no longer used and it will be removed in a future release.] Terraform provider version.").Envar("TERRAFORM_PROVIDER_VERSION").Hidden().Action(deprecationAction("terraform-provider-version")).String() + _ = app.Flag("terraform-native-provider-path", "[DEPRECATED: This option is no longer used and it will be removed in a future release.] Terraform native provider path for shared execution.").Envar("TERRAFORM_NATIVE_PROVIDER_PATH").Hidden().Action(deprecationAction("terraform-native-provider-path")).String() + _ = app.Flag("terraform-provider-source", "[DEPRECATED: This option is no longer used and it will be removed in a future release.] Terraform provider source.").Envar("TERRAFORM_PROVIDER_SOURCE").Hidden().Action(deprecationAction("terraform-provider-source")).String() + ) + + kingpin.MustParse(app.Parse(os.Args[1:])) + log.Default().SetOutput(io.Discard) + ctrl.SetLogger(zap.New(zap.WriteTo(io.Discard))) + + zl := zap.New(zap.UseDevMode(*debug)) + logr := logging.NewLogrLogger(zl.WithName("provider-gcp")) + if *debug { + // The controller-runtime runs with a no-op logger by default. It is + // *very* verbose even at info level, so we only provide it a real + // logger when we're running in debug mode. + ctrl.SetLogger(zl) + } + + // currently, we configure the jitter to be the 5% of the poll interval + pollJitter := time.Duration(float64(*pollInterval) * 0.05) + logr.Debug("Starting", "sync-interval", syncInterval.String(), + "poll-interval", pollInterval.String(), "poll-jitter", pollJitter, "max-reconcile-rate", *maxReconcileRate) + + cfg, err := ctrl.GetConfig() + kingpin.FatalIfError(err, "Cannot get API server rest config") + + // Get the TLS certs directory from the environment variables set by + // Crossplane if they're available. + // In older XP versions we used WEBHOOK_TLS_CERT_DIR, in newer versions + // we use TLS_SERVER_CERTS_DIR. If an explicit certs dir is not supplied + // via the command-line options, then these environment variables are used + // instead. + if !certsDirSet { + // backwards-compatibility concerns + xpCertsDir := os.Getenv(certsDirEnvVar) + if xpCertsDir == "" { + xpCertsDir = os.Getenv(tlsServerCertDirEnvVar) + } + if xpCertsDir == "" { + xpCertsDir = os.Getenv(webhookTLSCertDirEnvVar) + } + // we probably don't need this condition but just to be on the + // safe side, if we are missing any kingpin machinery details... + if xpCertsDir != "" { + *certsDir = xpCertsDir + } + } + + mgr, err := ctrl.NewManager(ratelimiter.LimitRESTConfig(cfg, *maxReconcileRate), ctrl.Options{ + LeaderElection: *leaderElection, + LeaderElectionID: "crossplane-leader-election-provider-gcp-tags", + Cache: cache.Options{ + SyncPeriod: syncInterval, + }, + WebhookServer: webhook.NewServer( + webhook.Options{ + CertDir: *certsDir, + }), + LeaderElectionResourceLock: resourcelock.LeasesResourceLock, + LeaseDuration: func() *time.Duration { d := 60 * time.Second; return &d }(), + RenewDeadline: func() *time.Duration { d := 50 * time.Second; return &d }(), + }) + kingpin.FatalIfError(err, "Cannot create controller manager") + kingpin.FatalIfError(apis.AddToScheme(mgr.GetScheme()), "Cannot add GCP APIs to scheme") + kingpin.FatalIfError(resolverapis.BuildScheme(apis.AddToSchemes), "Cannot register the GCP APIs with the API resolver's runtime scheme") + + metricRecorder := managed.NewMRMetricRecorder() + stateMetrics := statemetrics.NewMRStateMetrics() + + metrics.Registry.MustRegister(metricRecorder) + metrics.Registry.MustRegister(stateMetrics) + + ctx := context.Background() + provider, err := config.GetProvider(ctx, false) + kingpin.FatalIfError(err, "Cannot initialize the provider configuration") + o := tjcontroller.Options{ + Options: xpcontroller.Options{ + Logger: logr, + GlobalRateLimiter: ratelimiter.NewGlobal(*maxReconcileRate), + PollInterval: *pollInterval, + MaxConcurrentReconciles: *maxReconcileRate, + Features: &feature.Flags{}, + MetricOptions: &xpcontroller.MetricOptions{ + PollStateMetricInterval: *pollStateMetricInterval, + MRMetrics: metricRecorder, + MRStateMetrics: stateMetrics, + }, + }, + Provider: provider, + SetupFn: clients.TerraformSetupBuilder(provider.TerraformProvider), + PollJitter: pollJitter, + OperationTrackerStore: tjcontroller.NewOperationStore(logr), + StartWebhooks: *certsDir != "", + } + + if *enableManagementPolicies { + o.Features.Enable(features.EnableBetaManagementPolicies) + logr.Info("Beta feature enabled", "flag", features.EnableBetaManagementPolicies) + } + + if *enableExternalSecretStores { + o.SecretStoreConfigGVK = &v1alpha1.StoreConfigGroupVersionKind + logr.Info("Alpha feature enabled", "flag", features.EnableAlphaExternalSecretStores) + + o.ESSOptions = &tjcontroller.ESSOptions{} + if *essTLSCertsPath != "" { + logr.Info("ESS TLS certificates path is set. Loading mTLS configuration.") + tCfg, err := certificates.LoadMTLSConfig(filepath.Join(*essTLSCertsPath, "ca.crt"), filepath.Join(*essTLSCertsPath, "tls.crt"), filepath.Join(*essTLSCertsPath, "tls.key"), false) + kingpin.FatalIfError(err, "Cannot load ESS TLS config.") + + o.ESSOptions.TLSConfig = tCfg + } + + // Ensure default store config exists. + kingpin.FatalIfError(resource.Ignore(kerrors.IsAlreadyExists, mgr.GetClient().Create(ctx, &v1alpha1.StoreConfig{ + TypeMeta: metav1.TypeMeta{}, + ObjectMeta: metav1.ObjectMeta{ + Name: "default", + }, + Spec: v1alpha1.StoreConfigSpec{ + // NOTE(turkenh): We only set required spec and expect optional + // ones to properly be initialized with CRD level default values. + SecretStoreConfig: xpv1.SecretStoreConfig{ + DefaultScope: *namespace, + }, + }, + Status: v1alpha1.StoreConfigStatus{}, + })), "cannot create default store config") + } + + kingpin.FatalIfError(conversion.RegisterConversions(o.Provider), "Cannot initialize the webhook conversion registry") + kingpin.FatalIfError(controller.Setup_tags(mgr, o), "Cannot setup GCP controllers") + kingpin.FatalIfError(mgr.Start(ctrl.SetupSignalHandler()), "Cannot start controller manager") +} diff --git a/examples-generated/tags/v1beta1/tagbinding.yaml b/examples-generated/tags/v1beta1/tagbinding.yaml new file mode 100644 index 000000000..f0f58aba2 --- /dev/null +++ b/examples-generated/tags/v1beta1/tagbinding.yaml @@ -0,0 +1,64 @@ +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagBinding +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagbinding + labels: + testing.upbound.io/example-name: binding + name: binding +spec: + forProvider: + parent: //cloudresourcemanager.googleapis.com/projects/${google_project.project.number} + tagValueSelector: + matchLabels: + testing.upbound.io/example-name: value + +--- + +apiVersion: cloudplatform.gcp.upbound.io/v1beta1 +kind: Project +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagbinding + labels: + testing.upbound.io/example-name: project + name: project +spec: + forProvider: + name: project_id + orgId: "123456789" + projectId: project_id + +--- + +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagKey +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagbinding + labels: + testing.upbound.io/example-name: key + name: key +spec: + forProvider: + description: For keyname resources. + parent: organizations/123456789 + shortName: keyname + +--- + +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagValue +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagbinding + labels: + testing.upbound.io/example-name: value + name: value +spec: + forProvider: + description: For valuename resources. + parentSelector: + matchLabels: + testing.upbound.io/example-name: key + shortName: valuename diff --git a/examples-generated/tags/v1beta1/tagkey.yaml b/examples-generated/tags/v1beta1/tagkey.yaml new file mode 100644 index 000000000..606ba9123 --- /dev/null +++ b/examples-generated/tags/v1beta1/tagkey.yaml @@ -0,0 +1,13 @@ +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagKey +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagkey + labels: + testing.upbound.io/example-name: key + name: key +spec: + forProvider: + description: For keyname resources. + parent: organizations/123456789 + shortName: keyname diff --git a/examples-generated/tags/v1beta1/tagvalue.yaml b/examples-generated/tags/v1beta1/tagvalue.yaml new file mode 100644 index 000000000..65da3c84e --- /dev/null +++ b/examples-generated/tags/v1beta1/tagvalue.yaml @@ -0,0 +1,31 @@ +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagValue +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagvalue + labels: + testing.upbound.io/example-name: value + name: value +spec: + forProvider: + description: For valuename resources. + parentSelector: + matchLabels: + testing.upbound.io/example-name: key + shortName: valuename + +--- + +apiVersion: tags.gcp.upbound.io/v1beta1 +kind: TagKey +metadata: + annotations: + meta.upbound.io/example-id: tags/v1beta1/tagvalue + labels: + testing.upbound.io/example-name: key + name: key +spec: + forProvider: + description: For keyname resources. + parent: organizations/123456789 + shortName: keyname diff --git a/internal/controller/tags/tagbinding/zz_controller.go b/internal/controller/tags/tagbinding/zz_controller.go new file mode 100755 index 000000000..8e34f5488 --- /dev/null +++ b/internal/controller/tags/tagbinding/zz_controller.go @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package tagbinding + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/handler" + "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" + ctrl "sigs.k8s.io/controller-runtime" + + v1beta1 "github.com/upbound/provider-gcp/apis/tags/v1beta1" + features "github.com/upbound/provider-gcp/internal/features" +) + +// Setup adds a controller that reconciles TagBinding managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1beta1.TagBinding_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) + } + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.TagBinding_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TagBinding_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter( + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_tags_tag_binding"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TagBinding_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } + if o.Features.Enabled(features.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + // register webhooks for the kind v1beta1.TagBinding + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TagBinding{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TagBinding") + } + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TagBindingList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TagBindingList") + } + } + + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TagBinding_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + WithEventFilter(xpresource.DesiredStateChanged()). + Watches(&v1beta1.TagBinding{}, eventHandler). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/tags/tagkey/zz_controller.go b/internal/controller/tags/tagkey/zz_controller.go new file mode 100755 index 000000000..ae853ab06 --- /dev/null +++ b/internal/controller/tags/tagkey/zz_controller.go @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package tagkey + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/handler" + "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" + ctrl "sigs.k8s.io/controller-runtime" + + v1beta1 "github.com/upbound/provider-gcp/apis/tags/v1beta1" + features "github.com/upbound/provider-gcp/internal/features" +) + +// Setup adds a controller that reconciles TagKey managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1beta1.TagKey_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) + } + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.TagKey_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TagKey_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter( + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_tags_tag_key"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TagKey_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } + if o.Features.Enabled(features.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + // register webhooks for the kind v1beta1.TagKey + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TagKey{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TagKey") + } + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TagKeyList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TagKeyList") + } + } + + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TagKey_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + WithEventFilter(xpresource.DesiredStateChanged()). + Watches(&v1beta1.TagKey{}, eventHandler). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/tags/tagvalue/zz_controller.go b/internal/controller/tags/tagvalue/zz_controller.go new file mode 100755 index 000000000..1b19f3e33 --- /dev/null +++ b/internal/controller/tags/tagvalue/zz_controller.go @@ -0,0 +1,91 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +// Code generated by upjet. DO NOT EDIT. + +package tagvalue + +import ( + "time" + + "github.com/crossplane/crossplane-runtime/pkg/connection" + "github.com/crossplane/crossplane-runtime/pkg/event" + "github.com/crossplane/crossplane-runtime/pkg/ratelimiter" + "github.com/crossplane/crossplane-runtime/pkg/reconciler/managed" + xpresource "github.com/crossplane/crossplane-runtime/pkg/resource" + "github.com/crossplane/crossplane-runtime/pkg/statemetrics" + tjcontroller "github.com/crossplane/upjet/pkg/controller" + "github.com/crossplane/upjet/pkg/controller/handler" + "github.com/crossplane/upjet/pkg/metrics" + "github.com/pkg/errors" + ctrl "sigs.k8s.io/controller-runtime" + + v1beta1 "github.com/upbound/provider-gcp/apis/tags/v1beta1" + features "github.com/upbound/provider-gcp/internal/features" +) + +// Setup adds a controller that reconciles TagValue managed resources. +func Setup(mgr ctrl.Manager, o tjcontroller.Options) error { + name := managed.ControllerName(v1beta1.TagValue_GroupVersionKind.String()) + var initializers managed.InitializerChain + cps := []managed.ConnectionPublisher{managed.NewAPISecretPublisher(mgr.GetClient(), mgr.GetScheme())} + if o.SecretStoreConfigGVK != nil { + cps = append(cps, connection.NewDetailsManager(mgr.GetClient(), *o.SecretStoreConfigGVK, connection.WithTLSConfig(o.ESSOptions.TLSConfig))) + } + eventHandler := handler.NewEventHandler(handler.WithLogger(o.Logger.WithValues("gvk", v1beta1.TagValue_GroupVersionKind))) + ac := tjcontroller.NewAPICallbacks(mgr, xpresource.ManagedKind(v1beta1.TagValue_GroupVersionKind), tjcontroller.WithEventHandler(eventHandler), tjcontroller.WithStatusUpdates(false)) + opts := []managed.ReconcilerOption{ + managed.WithExternalConnecter( + tjcontroller.NewTerraformPluginSDKAsyncConnector(mgr.GetClient(), o.OperationTrackerStore, o.SetupFn, o.Provider.Resources["google_tags_tag_value"], + tjcontroller.WithTerraformPluginSDKAsyncLogger(o.Logger), + tjcontroller.WithTerraformPluginSDKAsyncConnectorEventHandler(eventHandler), + tjcontroller.WithTerraformPluginSDKAsyncCallbackProvider(ac), + tjcontroller.WithTerraformPluginSDKAsyncMetricRecorder(metrics.NewMetricRecorder(v1beta1.TagValue_GroupVersionKind, mgr, o.PollInterval)), + tjcontroller.WithTerraformPluginSDKAsyncManagementPolicies(o.Features.Enabled(features.EnableBetaManagementPolicies)))), + managed.WithLogger(o.Logger.WithValues("controller", name)), + managed.WithRecorder(event.NewAPIRecorder(mgr.GetEventRecorderFor(name))), + managed.WithFinalizer(tjcontroller.NewOperationTrackerFinalizer(o.OperationTrackerStore, xpresource.NewAPIFinalizer(mgr.GetClient(), managed.FinalizerName))), + managed.WithTimeout(3 * time.Minute), + managed.WithInitializers(initializers), + managed.WithConnectionPublishers(cps...), + managed.WithPollInterval(o.PollInterval), + } + if o.PollJitter != 0 { + opts = append(opts, managed.WithPollJitterHook(o.PollJitter)) + } + if o.Features.Enabled(features.EnableBetaManagementPolicies) { + opts = append(opts, managed.WithManagementPolicies()) + } + if o.MetricOptions != nil { + opts = append(opts, managed.WithMetricRecorder(o.MetricOptions.MRMetrics)) + } + + // register webhooks for the kind v1beta1.TagValue + // if they're enabled. + if o.StartWebhooks { + if err := ctrl.NewWebhookManagedBy(mgr). + For(&v1beta1.TagValue{}). + Complete(); err != nil { + return errors.Wrap(err, "cannot register webhook for the kind v1beta1.TagValue") + } + } + + if o.MetricOptions != nil && o.MetricOptions.MRStateMetrics != nil { + stateMetricsRecorder := statemetrics.NewMRStateRecorder( + mgr.GetClient(), o.Logger, o.MetricOptions.MRStateMetrics, &v1beta1.TagValueList{}, o.MetricOptions.PollStateMetricInterval, + ) + if err := mgr.Add(stateMetricsRecorder); err != nil { + return errors.Wrap(err, "cannot register MR state metrics recorder for kind v1beta1.TagValueList") + } + } + + r := managed.NewReconciler(mgr, xpresource.ManagedKind(v1beta1.TagValue_GroupVersionKind), opts...) + + return ctrl.NewControllerManagedBy(mgr). + Named(name). + WithOptions(o.ForControllerRuntime()). + WithEventFilter(xpresource.DesiredStateChanged()). + Watches(&v1beta1.TagValue{}, eventHandler). + Complete(ratelimiter.NewReconciler(name, r, o.GlobalRateLimiter)) +} diff --git a/internal/controller/zz_monolith_setup.go b/internal/controller/zz_monolith_setup.go index ce9ed9a5b..9af138898 100755 --- a/internal/controller/zz_monolith_setup.go +++ b/internal/controller/zz_monolith_setup.go @@ -348,6 +348,9 @@ import ( objectaccesscontrol "github.com/upbound/provider-gcp/internal/controller/storage/objectaccesscontrol" objectacl "github.com/upbound/provider-gcp/internal/controller/storage/objectacl" agentpool "github.com/upbound/provider-gcp/internal/controller/storagetransfer/agentpool" + tagbinding "github.com/upbound/provider-gcp/internal/controller/tags/tagbinding" + tagkey "github.com/upbound/provider-gcp/internal/controller/tags/tagkey" + tagvalue "github.com/upbound/provider-gcp/internal/controller/tags/tagvalue" node "github.com/upbound/provider-gcp/internal/controller/tpu/node" datasetvertexai "github.com/upbound/provider-gcp/internal/controller/vertexai/dataset" featurestore "github.com/upbound/provider-gcp/internal/controller/vertexai/featurestore" @@ -700,6 +703,9 @@ func Setup_monolith(mgr ctrl.Manager, o controller.Options) error { objectaccesscontrol.Setup, objectacl.Setup, agentpool.Setup, + tagbinding.Setup, + tagkey.Setup, + tagvalue.Setup, node.Setup, datasetvertexai.Setup, featurestore.Setup, diff --git a/internal/controller/zz_tags_setup.go b/internal/controller/zz_tags_setup.go new file mode 100755 index 000000000..17ae8bef2 --- /dev/null +++ b/internal/controller/zz_tags_setup.go @@ -0,0 +1,30 @@ +// SPDX-FileCopyrightText: 2024 The Crossplane Authors +// +// SPDX-License-Identifier: Apache-2.0 + +package controller + +import ( + ctrl "sigs.k8s.io/controller-runtime" + + "github.com/crossplane/upjet/pkg/controller" + + tagbinding "github.com/upbound/provider-gcp/internal/controller/tags/tagbinding" + tagkey "github.com/upbound/provider-gcp/internal/controller/tags/tagkey" + tagvalue "github.com/upbound/provider-gcp/internal/controller/tags/tagvalue" +) + +// Setup_tags creates all controllers with the supplied logger and adds them to +// the supplied manager. +func Setup_tags(mgr ctrl.Manager, o controller.Options) error { + for _, setup := range []func(ctrl.Manager, controller.Options) error{ + tagbinding.Setup, + tagkey.Setup, + tagvalue.Setup, + } { + if err := setup(mgr, o); err != nil { + return err + } + } + return nil +} diff --git a/package/crds/tags.gcp.upbound.io_tagbindings.yaml b/package/crds/tags.gcp.upbound.io_tagbindings.yaml new file mode 100644 index 000000000..84a836ba8 --- /dev/null +++ b/package/crds/tags.gcp.upbound.io_tagbindings.yaml @@ -0,0 +1,509 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: tagbindings.tags.gcp.upbound.io +spec: + group: tags.gcp.upbound.io + names: + categories: + - crossplane + - managed + - gcp + kind: TagBinding + listKind: TagBindingList + plural: tagbindings + singular: tagbinding + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: TagBinding is the Schema for the TagBindings API. A TagBinding + represents a connection between a TagValue and a cloud resource (currently + project, folder, or organization). + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: TagBindingSpec defines the desired state of TagBinding + properties: + deletionPolicy: + default: Delete + description: |- + DeletionPolicy specifies what will happen to the underlying external + when this managed resource is deleted - either "Delete" or "Orphan" the + external resource. + This field is planned to be deprecated in favor of the ManagementPolicies + field in a future release. Currently, both could be set independently and + non-default values would be honored if the feature flag is enabled. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + parent: + description: The full resource name of the resource the TagValue + is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123 + type: string + tagValue: + description: The TagValue of the TagBinding. Must be of the form + tagValues/456. + type: string + tagValueRef: + description: Reference to a TagValue in tags to populate tagValue. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + tagValueSelector: + description: Selector for a TagValue in tags to populate tagValue. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + type: object + initProvider: + description: |- + THIS IS A BETA FIELD. It will be honored + unless the Management Policies feature flag is disabled. + InitProvider holds the same fields as ForProvider, with the exception + of Identifier and other resource reference fields. The fields that are + in InitProvider are merged into ForProvider when the resource is created. + The same fields are also added to the terraform ignore_changes hook, to + avoid updating them after creation. This is useful for fields that are + required on creation, but we do not desire to update them after creation, + for example because of an external controller is managing them, like an + autoscaler. + properties: + parent: + description: The full resource name of the resource the TagValue + is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123 + type: string + tagValue: + description: The TagValue of the TagBinding. Must be of the form + tagValues/456. + type: string + tagValueRef: + description: Reference to a TagValue in tags to populate tagValue. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + tagValueSelector: + description: Selector for a TagValue in tags to populate tagValue. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + type: object + managementPolicies: + default: + - '*' + description: |- + THIS IS A BETA FIELD. It is on by default but can be opted out + through a Crossplane feature flag. + ManagementPolicies specify the array of actions Crossplane is allowed to + take on the managed and external resources. + This field is planned to replace the DeletionPolicy field in a future + release. Currently, both could be set independently and non-default + values would be honored if the feature flag is enabled. If both are + custom, the DeletionPolicy field will be ignored. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md + items: + description: |- + A ManagementAction represents an action that the Crossplane controllers + can take on an external resource. + enum: + - Observe + - Create + - Update + - Delete + - LateInitialize + - '*' + type: string + type: array + providerConfigRef: + default: + name: default + description: |- + ProviderConfigReference specifies how the provider that will be used to + create, observe, update, and delete this managed resource should be + configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: |- + PublishConnectionDetailsTo specifies the connection secret config which + contains a name, metadata and a reference to secret store config to + which any connection details for this managed resource should be written. + Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: |- + SecretStoreConfigRef specifies which secret store config should be used + for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations are the annotations to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.annotations". + - It is up to Secret Store implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: |- + Labels are the labels/tags to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store types. + type: object + type: + description: |- + Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: |- + WriteConnectionSecretToReference specifies the namespace and name of a + Secret to which any connection details for this managed resource should + be written. Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + This field is planned to be replaced in a future release in favor of + PublishConnectionDetailsTo. Currently, both could be set independently + and connection details would be published to both without affecting + each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + x-kubernetes-validations: + - message: spec.forProvider.parent is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.parent) + || (has(self.initProvider) && has(self.initProvider.parent))' + status: + description: TagBindingStatus defines the observed state of TagBinding. + properties: + atProvider: + properties: + id: + description: an identifier for the resource with format tagBindings/{{name}} + type: string + name: + description: 'The generated id for the TagBinding. This is a string + of the form: tagBindings/{full-resource-name}/{tag-value-name}' + type: string + parent: + description: The full resource name of the resource the TagValue + is bound to. E.g. //cloudresourcemanager.googleapis.com/projects/123 + type: string + tagValue: + description: The TagValue of the TagBinding. Must be of the form + tagValues/456. + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time this condition transitioned from one + status to another. + format: date-time + type: string + message: + description: |- + A Message containing details about this condition's last transition from + one status to another, if any. + type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: |- + Type of this condition. At most one of each condition type may apply to + a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedGeneration: + description: |- + ObservedGeneration is the latest metadata.generation + which resulted in either a ready state, or stalled due to error + it can not recover from without human intervention. + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/package/crds/tags.gcp.upbound.io_tagkeys.yaml b/package/crds/tags.gcp.upbound.io_tagkeys.yaml new file mode 100644 index 000000000..fa8848ade --- /dev/null +++ b/package/crds/tags.gcp.upbound.io_tagkeys.yaml @@ -0,0 +1,433 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: tagkeys.tags.gcp.upbound.io +spec: + group: tags.gcp.upbound.io + names: + categories: + - crossplane + - managed + - gcp + kind: TagKey + listKind: TagKeyList + plural: tagkeys + singular: tagkey + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: TagKey is the Schema for the TagKeys API. A TagKey, used to group + a set of TagValues. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: TagKeySpec defines the desired state of TagKey + properties: + deletionPolicy: + default: Delete + description: |- + DeletionPolicy specifies what will happen to the underlying external + when this managed resource is deleted - either "Delete" or "Orphan" the + external resource. + This field is planned to be deprecated in favor of the ManagementPolicies + field in a future release. Currently, both could be set independently and + non-default values would be honored if the feature flag is enabled. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + description: + description: User-assigned description of the TagKey. Must not + exceed 256 characters. + type: string + parent: + description: Input only. The resource name of the new TagKey's + parent. Must be of the form organizations/{org_id} or projects/{project_id_or_number}. + type: string + purpose: + description: |- + Optional. A purpose cannot be changed once set. + A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. + Possible values are: GCE_FIREWALL. + type: string + purposeData: + additionalProperties: + type: string + description: |- + Optional. Purpose data cannot be changed once set. + Purpose data corresponds to the policy system that the tag is intended for. For example, the GCE_FIREWALL purpose expects data in the following format: network = "/". + type: object + x-kubernetes-map-type: granular + shortName: + description: |- + Input only. The user friendly name for a TagKey. The short name should be unique for TagKeys within the same tag namespace. + The short name must be 1-63 characters, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + type: string + type: object + initProvider: + description: |- + THIS IS A BETA FIELD. It will be honored + unless the Management Policies feature flag is disabled. + InitProvider holds the same fields as ForProvider, with the exception + of Identifier and other resource reference fields. The fields that are + in InitProvider are merged into ForProvider when the resource is created. + The same fields are also added to the terraform ignore_changes hook, to + avoid updating them after creation. This is useful for fields that are + required on creation, but we do not desire to update them after creation, + for example because of an external controller is managing them, like an + autoscaler. + properties: + description: + description: User-assigned description of the TagKey. Must not + exceed 256 characters. + type: string + parent: + description: Input only. The resource name of the new TagKey's + parent. Must be of the form organizations/{org_id} or projects/{project_id_or_number}. + type: string + purpose: + description: |- + Optional. A purpose cannot be changed once set. + A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. + Possible values are: GCE_FIREWALL. + type: string + purposeData: + additionalProperties: + type: string + description: |- + Optional. Purpose data cannot be changed once set. + Purpose data corresponds to the policy system that the tag is intended for. For example, the GCE_FIREWALL purpose expects data in the following format: network = "/". + type: object + x-kubernetes-map-type: granular + shortName: + description: |- + Input only. The user friendly name for a TagKey. The short name should be unique for TagKeys within the same tag namespace. + The short name must be 1-63 characters, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + type: string + type: object + managementPolicies: + default: + - '*' + description: |- + THIS IS A BETA FIELD. It is on by default but can be opted out + through a Crossplane feature flag. + ManagementPolicies specify the array of actions Crossplane is allowed to + take on the managed and external resources. + This field is planned to replace the DeletionPolicy field in a future + release. Currently, both could be set independently and non-default + values would be honored if the feature flag is enabled. If both are + custom, the DeletionPolicy field will be ignored. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md + items: + description: |- + A ManagementAction represents an action that the Crossplane controllers + can take on an external resource. + enum: + - Observe + - Create + - Update + - Delete + - LateInitialize + - '*' + type: string + type: array + providerConfigRef: + default: + name: default + description: |- + ProviderConfigReference specifies how the provider that will be used to + create, observe, update, and delete this managed resource should be + configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: |- + PublishConnectionDetailsTo specifies the connection secret config which + contains a name, metadata and a reference to secret store config to + which any connection details for this managed resource should be written. + Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: |- + SecretStoreConfigRef specifies which secret store config should be used + for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations are the annotations to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.annotations". + - It is up to Secret Store implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: |- + Labels are the labels/tags to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store types. + type: object + type: + description: |- + Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: |- + WriteConnectionSecretToReference specifies the namespace and name of a + Secret to which any connection details for this managed resource should + be written. Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + This field is planned to be replaced in a future release in favor of + PublishConnectionDetailsTo. Currently, both could be set independently + and connection details would be published to both without affecting + each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + x-kubernetes-validations: + - message: spec.forProvider.parent is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.parent) + || (has(self.initProvider) && has(self.initProvider.parent))' + - message: spec.forProvider.shortName is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.shortName) + || (has(self.initProvider) && has(self.initProvider.shortName))' + status: + description: TagKeyStatus defines the observed state of TagKey. + properties: + atProvider: + properties: + createTime: + description: |- + Output only. Creation time. + A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". + type: string + description: + description: User-assigned description of the TagKey. Must not + exceed 256 characters. + type: string + id: + description: an identifier for the resource with format tagKeys/{{name}} + type: string + name: + description: The generated numeric id for the TagKey. + type: string + namespacedName: + description: Output only. Namespaced name of the TagKey. + type: string + parent: + description: Input only. The resource name of the new TagKey's + parent. Must be of the form organizations/{org_id} or projects/{project_id_or_number}. + type: string + purpose: + description: |- + Optional. A purpose cannot be changed once set. + A purpose denotes that this Tag is intended for use in policies of a specific policy engine, and will involve that policy engine in management operations involving this Tag. + Possible values are: GCE_FIREWALL. + type: string + purposeData: + additionalProperties: + type: string + description: |- + Optional. Purpose data cannot be changed once set. + Purpose data corresponds to the policy system that the tag is intended for. For example, the GCE_FIREWALL purpose expects data in the following format: network = "/". + type: object + x-kubernetes-map-type: granular + shortName: + description: |- + Input only. The user friendly name for a TagKey. The short name should be unique for TagKeys within the same tag namespace. + The short name must be 1-63 characters, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + type: string + updateTime: + description: |- + Output only. Update time. + A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time this condition transitioned from one + status to another. + format: date-time + type: string + message: + description: |- + A Message containing details about this condition's last transition from + one status to another, if any. + type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: |- + Type of this condition. At most one of each condition type may apply to + a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedGeneration: + description: |- + ObservedGeneration is the latest metadata.generation + which resulted in either a ready state, or stalled due to error + it can not recover from without human intervention. + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/package/crds/tags.gcp.upbound.io_tagvalues.yaml b/package/crds/tags.gcp.upbound.io_tagvalues.yaml new file mode 100644 index 000000000..21ecf5133 --- /dev/null +++ b/package/crds/tags.gcp.upbound.io_tagvalues.yaml @@ -0,0 +1,536 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.14.0 + name: tagvalues.tags.gcp.upbound.io +spec: + group: tags.gcp.upbound.io + names: + categories: + - crossplane + - managed + - gcp + kind: TagValue + listKind: TagValueList + plural: tagvalues + singular: tagvalue + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.conditions[?(@.type=='Synced')].status + name: SYNCED + type: string + - jsonPath: .status.conditions[?(@.type=='Ready')].status + name: READY + type: string + - jsonPath: .metadata.annotations.crossplane\.io/external-name + name: EXTERNAL-NAME + type: string + - jsonPath: .metadata.creationTimestamp + name: AGE + type: date + name: v1beta1 + schema: + openAPIV3Schema: + description: TagValue is the Schema for the TagValues API. A TagValue is a + child of a particular TagKey. + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: TagValueSpec defines the desired state of TagValue + properties: + deletionPolicy: + default: Delete + description: |- + DeletionPolicy specifies what will happen to the underlying external + when this managed resource is deleted - either "Delete" or "Orphan" the + external resource. + This field is planned to be deprecated in favor of the ManagementPolicies + field in a future release. Currently, both could be set independently and + non-default values would be honored if the feature flag is enabled. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + enum: + - Orphan + - Delete + type: string + forProvider: + properties: + description: + description: User-assigned description of the TagValue. Must not + exceed 256 characters. + type: string + parent: + description: Input only. The resource name of the new TagValue's + parent. Must be of the form tagKeys/{tag_key_id}. + type: string + parentRef: + description: Reference to a TagKey in tags to populate parent. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + parentSelector: + description: Selector for a TagKey in tags to populate parent. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + shortName: + description: |- + Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey. + The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + type: string + type: object + initProvider: + description: |- + THIS IS A BETA FIELD. It will be honored + unless the Management Policies feature flag is disabled. + InitProvider holds the same fields as ForProvider, with the exception + of Identifier and other resource reference fields. The fields that are + in InitProvider are merged into ForProvider when the resource is created. + The same fields are also added to the terraform ignore_changes hook, to + avoid updating them after creation. This is useful for fields that are + required on creation, but we do not desire to update them after creation, + for example because of an external controller is managing them, like an + autoscaler. + properties: + description: + description: User-assigned description of the TagValue. Must not + exceed 256 characters. + type: string + parent: + description: Input only. The resource name of the new TagValue's + parent. Must be of the form tagKeys/{tag_key_id}. + type: string + parentRef: + description: Reference to a TagKey in tags to populate parent. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + parentSelector: + description: Selector for a TagKey in tags to populate parent. + properties: + matchControllerRef: + description: |- + MatchControllerRef ensures an object with the same controller reference + as the selecting object is selected. + type: boolean + matchLabels: + additionalProperties: + type: string + description: MatchLabels ensures an object with matching labels + is selected. + type: object + policy: + description: Policies for selection. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + type: object + shortName: + description: |- + Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey. + The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + type: string + type: object + managementPolicies: + default: + - '*' + description: |- + THIS IS A BETA FIELD. It is on by default but can be opted out + through a Crossplane feature flag. + ManagementPolicies specify the array of actions Crossplane is allowed to + take on the managed and external resources. + This field is planned to replace the DeletionPolicy field in a future + release. Currently, both could be set independently and non-default + values would be honored if the feature flag is enabled. If both are + custom, the DeletionPolicy field will be ignored. + See the design doc for more information: https://github.com/crossplane/crossplane/blob/499895a25d1a1a0ba1604944ef98ac7a1a71f197/design/design-doc-observe-only-resources.md?plain=1#L223 + and this one: https://github.com/crossplane/crossplane/blob/444267e84783136daa93568b364a5f01228cacbe/design/one-pager-ignore-changes.md + items: + description: |- + A ManagementAction represents an action that the Crossplane controllers + can take on an external resource. + enum: + - Observe + - Create + - Update + - Delete + - LateInitialize + - '*' + type: string + type: array + providerConfigRef: + default: + name: default + description: |- + ProviderConfigReference specifies how the provider that will be used to + create, observe, update, and delete this managed resource should be + configured. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + publishConnectionDetailsTo: + description: |- + PublishConnectionDetailsTo specifies the connection secret config which + contains a name, metadata and a reference to secret store config to + which any connection details for this managed resource should be written. + Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + properties: + configRef: + default: + name: default + description: |- + SecretStoreConfigRef specifies which secret store config should be used + for this ConnectionSecret. + properties: + name: + description: Name of the referenced object. + type: string + policy: + description: Policies for referencing. + properties: + resolution: + default: Required + description: |- + Resolution specifies whether resolution of this reference is required. + The default is 'Required', which means the reconcile will fail if the + reference cannot be resolved. 'Optional' means this reference will be + a no-op if it cannot be resolved. + enum: + - Required + - Optional + type: string + resolve: + description: |- + Resolve specifies when this reference should be resolved. The default + is 'IfNotPresent', which will attempt to resolve the reference only when + the corresponding field is not present. Use 'Always' to resolve the + reference on every reconcile. + enum: + - Always + - IfNotPresent + type: string + type: object + required: + - name + type: object + metadata: + description: Metadata is the metadata for connection secret. + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations are the annotations to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.annotations". + - It is up to Secret Store implementation for others store types. + type: object + labels: + additionalProperties: + type: string + description: |- + Labels are the labels/tags to be added to connection secret. + - For Kubernetes secrets, this will be used as "metadata.labels". + - It is up to Secret Store implementation for others store types. + type: object + type: + description: |- + Type is the SecretType for the connection secret. + - Only valid for Kubernetes Secret Stores. + type: string + type: object + name: + description: Name is the name of the connection secret. + type: string + required: + - name + type: object + writeConnectionSecretToRef: + description: |- + WriteConnectionSecretToReference specifies the namespace and name of a + Secret to which any connection details for this managed resource should + be written. Connection details frequently include the endpoint, username, + and password required to connect to the managed resource. + This field is planned to be replaced in a future release in favor of + PublishConnectionDetailsTo. Currently, both could be set independently + and connection details would be published to both without affecting + each other. + properties: + name: + description: Name of the secret. + type: string + namespace: + description: Namespace of the secret. + type: string + required: + - name + - namespace + type: object + required: + - forProvider + type: object + x-kubernetes-validations: + - message: spec.forProvider.shortName is a required parameter + rule: '!(''*'' in self.managementPolicies || ''Create'' in self.managementPolicies + || ''Update'' in self.managementPolicies) || has(self.forProvider.shortName) + || (has(self.initProvider) && has(self.initProvider.shortName))' + status: + description: TagValueStatus defines the observed state of TagValue. + properties: + atProvider: + properties: + createTime: + description: |- + Output only. Creation time. + A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". + type: string + description: + description: User-assigned description of the TagValue. Must not + exceed 256 characters. + type: string + id: + description: an identifier for the resource with format tagValues/{{name}} + type: string + name: + description: The generated numeric id for the TagValue. + type: string + namespacedName: + description: Output only. Namespaced name of the TagValue. Will + be in the format {parentNamespace}/{tagKeyShortName}/{shortName}. + type: string + parent: + description: Input only. The resource name of the new TagValue's + parent. Must be of the form tagKeys/{tag_key_id}. + type: string + shortName: + description: |- + Input only. User-assigned short name for TagValue. The short name should be unique for TagValues within the same parent TagKey. + The short name must be 63 characters or less, beginning and ending with an alphanumeric character ([a-z0-9A-Z]) with dashes (-), underscores (_), dots (.), and alphanumerics between. + type: string + updateTime: + description: |- + Output only. Update time. + A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z". + type: string + type: object + conditions: + description: Conditions of the resource. + items: + description: A Condition that may apply to a resource. + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time this condition transitioned from one + status to another. + format: date-time + type: string + message: + description: |- + A Message containing details about this condition's last transition from + one status to another, if any. + type: string + observedGeneration: + description: |- + ObservedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + type: integer + reason: + description: A Reason for this condition's last transition from + one status to another. + type: string + status: + description: Status of this condition; is it currently True, + False, or Unknown? + type: string + type: + description: |- + Type of this condition. At most one of each condition type may apply to + a resource at any point in time. + type: string + required: + - lastTransitionTime + - reason + - status + - type + type: object + type: array + x-kubernetes-list-map-keys: + - type + x-kubernetes-list-type: map + observedGeneration: + description: |- + ObservedGeneration is the latest metadata.generation + which resulted in either a ready state, or stalled due to error + it can not recover from without human intervention. + format: int64 + type: integer + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} From a8cf767ae9e35b6c36be18293deb57b9d9693e09 Mon Sep 17 00:00:00 2001 From: declement <104446084+declement@users.noreply.github.com> Date: Wed, 10 Jul 2024 16:29:40 +0200 Subject: [PATCH 3/3] fix(tags): add missing manual intervention annotations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fatih Türken <103541666+turkenf@users.noreply.github.com> Signed-off-by: declement --- examples/tags/v1beta1/tagbinding.yaml | 1 + examples/tags/v1beta1/tagvalue.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/examples/tags/v1beta1/tagbinding.yaml b/examples/tags/v1beta1/tagbinding.yaml index 8745ddb37..c70dc75ac 100644 --- a/examples/tags/v1beta1/tagbinding.yaml +++ b/examples/tags/v1beta1/tagbinding.yaml @@ -38,6 +38,7 @@ kind: TagValue metadata: annotations: meta.upbound.io/example-id: tags/v1beta1/tagbinding + upjet.upbound.io/manual-intervention: "This resource is skipped because the TagBinding resource is skipped" labels: testing.upbound.io/example-name: value name: value diff --git a/examples/tags/v1beta1/tagvalue.yaml b/examples/tags/v1beta1/tagvalue.yaml index 204ac33e4..50bfc5454 100644 --- a/examples/tags/v1beta1/tagvalue.yaml +++ b/examples/tags/v1beta1/tagvalue.yaml @@ -3,6 +3,7 @@ kind: TagValue metadata: annotations: meta.upbound.io/example-id: tags/v1beta1/tagvalue + upjet.upbound.io/manual-intervention: "This resource is skipped because the dependent resource is skipped" labels: testing.upbound.io/example-name: value name: value