How to use Connection method of validation Package

Best Gauge code snippet using validation.Connection

zz_endpoint_types.go

Source:zz_endpoint_types.go Github

copy

Full Screen

...28type ClickhouseSourceObservation struct {29}30type ClickhouseSourceParameters struct {31 // +kubebuilder:validation:Optional32 // (Required) Connection settings. The structure is documented below.33 Connection []ConnectionParameters `json:"connection,omitempty" tf:"connection,omitempty"`34 // +kubebuilder:validation:Optional35 // List of tables which will not be transfered, formatted as `schemaname.tablename`.36 ExcludeTables []*string `json:"excludeTables,omitempty" tf:"exclude_tables,omitempty"`37 // +kubebuilder:validation:Optional38 // List of tables to transfer, formatted as `schemaname.tablename`. If omitted or an empty list is specified, all tables will be transferred.39 IncludeTables []*string `json:"includeTables,omitempty" tf:"include_tables,omitempty"`40 // +kubebuilder:validation:Optional41 // (Optional) List of security groups that the transfer associated with this endpoint should use.42 SecurityGroups []*string `json:"securityGroups,omitempty" tf:"security_groups,omitempty"`43 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/vpc/v1alpha1.Subnet44 // +kubebuilder:validation:Optional45 // (Optional) Identifier of the Yandex Cloud VPC subnetwork to user for accessing the database. If omitted, the server has to be accessible via Internet.46 SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"`47 // +kubebuilder:validation:Optional48 SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"`49 // +kubebuilder:validation:Optional50 SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"`51}52type ClickhouseTargetConnectionObservation struct {53}54type ClickhouseTargetConnectionParameters struct {55 // +kubebuilder:validation:Optional56 ConnectionOptions []ConnectionConnectionOptionsParameters `json:"connectionOptions,omitempty" tf:"connection_options,omitempty"`57}58type ClickhouseTargetObservation struct {59}60type ClickhouseTargetParameters struct {61 // +kubebuilder:validation:Optional62 // (Optional) Table renaming rules. The structure is documented below.63 AltNames []AltNamesParameters `json:"altNames,omitempty" tf:"alt_names,omitempty"`64 // +kubebuilder:validation:Optional65 // (Optional) How to clean collections when activating the transfer. One of "DISABLED", "DROP" or "TRUNCATE".66 CleanupPolicy *string `json:"cleanupPolicy,omitempty" tf:"cleanup_policy,omitempty"`67 // +kubebuilder:validation:Optional68 // (Optional) Name of the ClickHouse cluster. For managed ClickHouse clusters defaults to managed cluster ID.69 ClickhouseClusterName *string `json:"clickhouseClusterName,omitempty" tf:"clickhouse_cluster_name,omitempty"`70 // +kubebuilder:validation:Optional71 // (Required) Connection settings. The structure is documented below.72 Connection []ClickhouseTargetConnectionParameters `json:"connection,omitempty" tf:"connection,omitempty"`73 // +kubebuilder:validation:Optional74 // (Optional) List of security groups that the transfer associated with this endpoint should use.75 SecurityGroups []*string `json:"securityGroups,omitempty" tf:"security_groups,omitempty"`76 // +kubebuilder:validation:Optional77 // (Optional) Shard selection rules for the data being transferred. The structure is documented below.78 Sharding []ShardingParameters `json:"sharding,omitempty" tf:"sharding,omitempty"`79 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/vpc/v1alpha1.Subnet80 // +kubebuilder:validation:Optional81 // (Optional) Identifier of the Yandex Cloud VPC subnetwork to user for accessing the database. If omitted, the server has to be accessible via Internet.82 SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"`83 // +kubebuilder:validation:Optional84 SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"`85 // +kubebuilder:validation:Optional86 SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"`87}88type CollectionsObservation struct {89}90type CollectionsParameters struct {91 // +kubebuilder:validation:Optional92 // (Required) Collection name.93 CollectionName *string `json:"collectionName,omitempty" tf:"collection_name,omitempty"`94 // +kubebuilder:validation:Optional95 // (Required) Database name.96 DatabaseName *string `json:"databaseName,omitempty" tf:"database_name,omitempty"`97}98type ColumnValueHashObservation struct {99}100type ColumnValueHashParameters struct {101 // +kubebuilder:validation:Optional102 // The name of the column to calculate hash from.103 ColumnName *string `json:"columnName,omitempty" tf:"column_name,omitempty"`104}105type ConnectionConnectionOptionsObservation struct {106}107type ConnectionConnectionOptionsOnPremiseObservation struct {108}109type ConnectionConnectionOptionsOnPremiseParameters struct {110 // +kubebuilder:validation:Optional111 // (Required) List of host names of the PostgreSQL server. Exactly one host is expected currently.112 Hosts []*string `json:"hosts,omitempty" tf:"hosts,omitempty"`113 // +kubebuilder:validation:Optional114 // (Required) Port for the database connection.115 Port *float64 `json:"port,omitempty" tf:"port,omitempty"`116 // +kubebuilder:validation:Optional117 // (Optional) Replica set name.118 ReplicaSet *string `json:"replicaSet,omitempty" tf:"replica_set,omitempty"`119 // +kubebuilder:validation:Optional120 // (Optional) TLS settings for the server connection. Empty implies plaintext connection. The structure is documented below.121 TLSMode []ConnectionOptionsOnPremiseTLSModeParameters `json:"tlsMode,omitempty" tf:"tls_mode,omitempty"`122}123type ConnectionConnectionOptionsOnPremiseTLSModeObservation struct {124}125type ConnectionConnectionOptionsOnPremiseTLSModeParameters struct {126 // +kubebuilder:validation:Optional127 // Empty block designating that the connection is not secured, i.e. plaintext connection.128 Disabled []ConnectionOptionsOnPremiseTLSModeDisabledParameters `json:"disabled,omitempty" tf:"disabled,omitempty"`129 // +kubebuilder:validation:Optional130 // If this attribute is not an empty block, then TLS is used for the server connection. The structure is documented below.131 Enabled []ConnectionOptionsOnPremiseTLSModeEnabledParameters `json:"enabled,omitempty" tf:"enabled,omitempty"`132}133type ConnectionConnectionOptionsParameters struct {134 // +kubebuilder:validation:Optional135 // (Required) Name of the database to transfer.136 Database *string `json:"database,omitempty" tf:"database,omitempty"`137 // +kubebuilder:validation:Optional138 // Identifier of the Managed PostgreSQL cluster.139 MdbClusterID *string `json:"mdbClusterId,omitempty" tf:"mdb_cluster_id,omitempty"`140 // +kubebuilder:validation:Optional141 // Connection settings of the on-premise PostgreSQL server.142 OnPremise []ConnectionOptionsOnPremiseParameters `json:"onPremise,omitempty" tf:"on_premise,omitempty"`143 // +kubebuilder:validation:Optional144 // (Required) Password for the database access. This is a block with a single field named `raw` which should contain the password.145 Password []ConnectionOptionsPasswordParameters `json:"password,omitempty" tf:"password,omitempty"`146 // +kubebuilder:validation:Optional147 // (Required) User for the database access.148 User *string `json:"user,omitempty" tf:"user,omitempty"`149}150type ConnectionConnectionOptionsPasswordObservation struct {151}152type ConnectionConnectionOptionsPasswordParameters struct {153 // +kubebuilder:validation:Optional154 RawSecretRef *v1.SecretKeySelector `json:"rawSecretRef,omitempty" tf:"-"`155}156type ConnectionObservation struct {157}158type ConnectionOnPremiseObservation struct {159}160type ConnectionOnPremiseParameters struct {161 // +kubebuilder:validation:Optional162 // (Required) List of host names of the PostgreSQL server. Exactly one host is expected currently.163 Hosts []*string `json:"hosts,omitempty" tf:"hosts,omitempty"`164 // +kubebuilder:validation:Optional165 // (Required) Port for the database connection.166 Port *float64 `json:"port,omitempty" tf:"port,omitempty"`167 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/vpc/v1alpha1.Subnet168 // +kubebuilder:validation:Optional169 // (Optional) Identifier of the Yandex Cloud VPC subnetwork to user for accessing the database. If omitted, the server has to be accessible via Internet.170 SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"`171 // +kubebuilder:validation:Optional172 SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"`173 // +kubebuilder:validation:Optional174 SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"`175 // +kubebuilder:validation:Optional176 // (Optional) TLS settings for the server connection. Empty implies plaintext connection. The structure is documented below.177 TLSMode []ConnectionOnPremiseTLSModeParameters `json:"tlsMode,omitempty" tf:"tls_mode,omitempty"`178}179type ConnectionOnPremiseTLSModeDisabledObservation struct {180}181type ConnectionOnPremiseTLSModeDisabledParameters struct {182}183type ConnectionOnPremiseTLSModeEnabledObservation struct {184}185type ConnectionOnPremiseTLSModeEnabledParameters struct {186 // +kubebuilder:validation:Optional187 // (Optional) X.509 certificate of the certificate authority which issued the server's certificate, in PEM format. If empty, the server's certificate must be signed by a well-known CA.188 CACertificate *string `json:"caCertificate,omitempty" tf:"ca_certificate,omitempty"`189}190type ConnectionOnPremiseTLSModeObservation struct {191}192type ConnectionOnPremiseTLSModeParameters struct {193 // +kubebuilder:validation:Optional194 // Empty block designating that the connection is not secured, i.e. plaintext connection.195 Disabled []ConnectionOnPremiseTLSModeDisabledParameters `json:"disabled,omitempty" tf:"disabled,omitempty"`196 // +kubebuilder:validation:Optional197 // If this attribute is not an empty block, then TLS is used for the server connection. The structure is documented below.198 Enabled []ConnectionOnPremiseTLSModeEnabledParameters `json:"enabled,omitempty" tf:"enabled,omitempty"`199}200type ConnectionOptionsObservation struct {201}202type ConnectionOptionsOnPremiseObservation struct {203}204type ConnectionOptionsOnPremiseParameters struct {205 // +kubebuilder:validation:Optional206 // (Required) TCP port number for the HTTP interface of the ClickHouse server.207 HTTPPort *float64 `json:"httpPort,omitempty" tf:"http_port,omitempty"`208 // +kubebuilder:validation:Optional209 // (Required) TCP port number for the native interface of the ClickHouse server.210 NativePort *float64 `json:"nativePort,omitempty" tf:"native_port,omitempty"`211 // +kubebuilder:validation:Optional212 // (Required) The list of ClickHouse shards. The structure is documented below.213 Shards []OnPremiseShardsParameters `json:"shards,omitempty" tf:"shards,omitempty"`214 // +kubebuilder:validation:Optional215 // (Optional) TLS settings for the server connection. Empty implies plaintext connection. The structure is documented below.216 TLSMode []OnPremiseTLSModeParameters `json:"tlsMode,omitempty" tf:"tls_mode,omitempty"`217}218type ConnectionOptionsOnPremiseTLSModeDisabledObservation struct {219}220type ConnectionOptionsOnPremiseTLSModeDisabledParameters struct {221}222type ConnectionOptionsOnPremiseTLSModeEnabledObservation struct {223}224type ConnectionOptionsOnPremiseTLSModeEnabledParameters struct {225 // +kubebuilder:validation:Optional226 // (Optional) X.509 certificate of the certificate authority which issued the server's certificate, in PEM format. If empty, the server's certificate must be signed by a well-known CA.227 CACertificate *string `json:"caCertificate,omitempty" tf:"ca_certificate,omitempty"`228}229type ConnectionOptionsOnPremiseTLSModeObservation struct {230}231type ConnectionOptionsOnPremiseTLSModeParameters struct {232 // +kubebuilder:validation:Optional233 // Empty block designating that the connection is not secured, i.e. plaintext connection.234 Disabled []OnPremiseTLSModeDisabledParameters `json:"disabled,omitempty" tf:"disabled,omitempty"`235 // +kubebuilder:validation:Optional236 // If this attribute is not an empty block, then TLS is used for the server connection. The structure is documented below.237 Enabled []OnPremiseTLSModeEnabledParameters `json:"enabled,omitempty" tf:"enabled,omitempty"`238}239type ConnectionOptionsParameters struct {240 // +kubebuilder:validation:Optional241 // (Required) Name of the database to transfer.242 Database *string `json:"database,omitempty" tf:"database,omitempty"`243 // +kubebuilder:validation:Optional244 // Identifier of the Managed PostgreSQL cluster.245 MdbClusterID *string `json:"mdbClusterId,omitempty" tf:"mdb_cluster_id,omitempty"`246 // +kubebuilder:validation:Optional247 // Connection settings of the on-premise PostgreSQL server.248 OnPremise []OnPremiseParameters `json:"onPremise,omitempty" tf:"on_premise,omitempty"`249 // +kubebuilder:validation:Optional250 // (Required) Password for the database access. This is a block with a single field named `raw` which should contain the password.251 Password []PasswordParameters `json:"password,omitempty" tf:"password,omitempty"`252 // +kubebuilder:validation:Optional253 // (Required) User for the database access.254 User *string `json:"user,omitempty" tf:"user,omitempty"`255}256type ConnectionOptionsPasswordObservation struct {257}258type ConnectionOptionsPasswordParameters struct {259 // +kubebuilder:validation:Optional260 RawSecretRef *v1.SecretKeySelector `json:"rawSecretRef,omitempty" tf:"-"`261}262type ConnectionParameters struct {263 // +kubebuilder:validation:Optional264 ConnectionOptions []ConnectionOptionsParameters `json:"connectionOptions,omitempty" tf:"connection_options,omitempty"`265}266type DisabledObservation struct {267}268type DisabledParameters struct {269}270type EnabledObservation struct {271}272type EnabledParameters struct {273 // +kubebuilder:validation:Optional274 // (Optional) X.509 certificate of the certificate authority which issued the server's certificate, in PEM format. If empty, the server's certificate must be signed by a well-known CA.275 CACertificate *string `json:"caCertificate,omitempty" tf:"ca_certificate,omitempty"`276}277type EndpointObservation struct {278 // (Computed) Identifier of a new Data Transfer endpoint.279 ID *string `json:"id,omitempty" tf:"id,omitempty"`280}281type EndpointParameters struct {282 // +kubebuilder:validation:Optional283 // (Optional) Arbitrary description text for the endpoint.284 Description *string `json:"description,omitempty" tf:"description,omitempty"`285 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/resourcemanager/v1alpha1.Folder286 // +kubebuilder:validation:Optional287 // (Optional) ID of the folder to create the endpoint in. If it is not provided, the default provider folder is used.288 FolderID *string `json:"folderId,omitempty" tf:"folder_id,omitempty"`289 // +kubebuilder:validation:Optional290 FolderIDRef *v1.Reference `json:"folderIdRef,omitempty" tf:"-"`291 // +kubebuilder:validation:Optional292 FolderIDSelector *v1.Selector `json:"folderIdSelector,omitempty" tf:"-"`293 // +kubebuilder:validation:Optional294 // (Optional) A set of key/value label pairs to assign to the Data Transfer endpoint.295 Labels map[string]*string `json:"labels,omitempty" tf:"labels,omitempty"`296 // +kubebuilder:validation:Optional297 // (Required) Name of the endpoint.298 Name *string `json:"name,omitempty" tf:"name,omitempty"`299 // +kubebuilder:validation:Optional300 // (Required) Settings for the endpoint. The structure is documented below.301 Settings []SettingsParameters `json:"settings,omitempty" tf:"settings,omitempty"`302}303type ExcludedCollectionsObservation struct {304}305type ExcludedCollectionsParameters struct {306 // +kubebuilder:validation:Optional307 // (Required) Collection name.308 CollectionName *string `json:"collectionName,omitempty" tf:"collection_name,omitempty"`309 // +kubebuilder:validation:Optional310 // (Required) Database name.311 DatabaseName *string `json:"databaseName,omitempty" tf:"database_name,omitempty"`312}313type MongoSourceConnectionConnectionOptionsObservation struct {314}315type MongoSourceConnectionConnectionOptionsParameters struct {316 // +kubebuilder:validation:Optional317 // (Required) Name of the database associated with the credentials.318 AuthSource *string `json:"authSource,omitempty" tf:"auth_source,omitempty"`319 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/mdb/v1alpha1.MongodbCluster320 // +kubebuilder:validation:Optional321 // Identifier of the Managed PostgreSQL cluster.322 MdbClusterID *string `json:"mdbClusterId,omitempty" tf:"mdb_cluster_id,omitempty"`323 // +kubebuilder:validation:Optional324 MdbClusterIDRef *v1.Reference `json:"mdbClusterIdRef,omitempty" tf:"-"`325 // +kubebuilder:validation:Optional326 MdbClusterIDSelector *v1.Selector `json:"mdbClusterIdSelector,omitempty" tf:"-"`327 // +kubebuilder:validation:Optional328 // Connection settings of the on-premise PostgreSQL server.329 OnPremise []ConnectionConnectionOptionsOnPremiseParameters `json:"onPremise,omitempty" tf:"on_premise,omitempty"`330 // +kubebuilder:validation:Optional331 // (Required) Password for the database access. This is a block with a single field named `raw` which should contain the password.332 Password []ConnectionConnectionOptionsPasswordParameters `json:"password,omitempty" tf:"password,omitempty"`333 // +kubebuilder:validation:Optional334 // (Required) User for the database access.335 User *string `json:"user,omitempty" tf:"user,omitempty"`336}337type MongoSourceConnectionObservation struct {338}339type MongoSourceConnectionParameters struct {340 // +kubebuilder:validation:Optional341 ConnectionOptions []MongoSourceConnectionConnectionOptionsParameters `json:"connectionOptions,omitempty" tf:"connection_options,omitempty"`342}343type MongoSourceObservation struct {344}345type MongoSourceParameters struct {346 // +kubebuilder:validation:Optional347 // (Optional) The list of the MongoDB collections that should be transferred. If omitted, all available collections will be transferred. The structure of the list item is documented below.348 Collections []CollectionsParameters `json:"collections,omitempty" tf:"collections,omitempty"`349 // +kubebuilder:validation:Optional350 // (Required) Connection settings. The structure is documented below.351 Connection []MongoSourceConnectionParameters `json:"connection,omitempty" tf:"connection,omitempty"`352 // +kubebuilder:validation:Optional353 // (Optional) The list of the MongoDB collections that should not be transferred.354 ExcludedCollections []ExcludedCollectionsParameters `json:"excludedCollections,omitempty" tf:"excluded_collections,omitempty"`355 // +kubebuilder:validation:Optional356 // (Optional) whether the secondary server should be preferred to the primary when copying data.357 SecondaryPreferredMode *bool `json:"secondaryPreferredMode,omitempty" tf:"secondary_preferred_mode,omitempty"`358 // +kubebuilder:validation:Optional359 // (Optional) List of security groups that the transfer associated with this endpoint should use.360 SecurityGroups []*string `json:"securityGroups,omitempty" tf:"security_groups,omitempty"`361 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/vpc/v1alpha1.Subnet362 // +kubebuilder:validation:Optional363 // (Optional) Identifier of the Yandex Cloud VPC subnetwork to user for accessing the database. If omitted, the server has to be accessible via Internet.364 SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"`365 // +kubebuilder:validation:Optional366 SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"`367 // +kubebuilder:validation:Optional368 SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"`369}370type MongoTargetConnectionConnectionOptionsObservation struct {371}372type MongoTargetConnectionConnectionOptionsOnPremiseObservation struct {373}374type MongoTargetConnectionConnectionOptionsOnPremiseParameters struct {375 // +kubebuilder:validation:Optional376 // (Required) List of host names of the PostgreSQL server. Exactly one host is expected currently.377 Hosts []*string `json:"hosts,omitempty" tf:"hosts,omitempty"`378 // +kubebuilder:validation:Optional379 // (Required) Port for the database connection.380 Port *float64 `json:"port,omitempty" tf:"port,omitempty"`381 // +kubebuilder:validation:Optional382 // (Optional) Replica set name.383 ReplicaSet *string `json:"replicaSet,omitempty" tf:"replica_set,omitempty"`384 // +kubebuilder:validation:Optional385 // (Optional) TLS settings for the server connection. Empty implies plaintext connection. The structure is documented below.386 TLSMode []ConnectionConnectionOptionsOnPremiseTLSModeParameters `json:"tlsMode,omitempty" tf:"tls_mode,omitempty"`387}388type MongoTargetConnectionConnectionOptionsParameters struct {389 // +kubebuilder:validation:Optional390 // (Required) Name of the database associated with the credentials.391 AuthSource *string `json:"authSource,omitempty" tf:"auth_source,omitempty"`392 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/mdb/v1alpha1.MongodbCluster393 // +kubebuilder:validation:Optional394 // Identifier of the Managed PostgreSQL cluster.395 MdbClusterID *string `json:"mdbClusterId,omitempty" tf:"mdb_cluster_id,omitempty"`396 // +kubebuilder:validation:Optional397 MdbClusterIDRef *v1.Reference `json:"mdbClusterIdRef,omitempty" tf:"-"`398 // +kubebuilder:validation:Optional399 MdbClusterIDSelector *v1.Selector `json:"mdbClusterIdSelector,omitempty" tf:"-"`400 // +kubebuilder:validation:Optional401 // Connection settings of the on-premise PostgreSQL server.402 OnPremise []MongoTargetConnectionConnectionOptionsOnPremiseParameters `json:"onPremise,omitempty" tf:"on_premise,omitempty"`403 // +kubebuilder:validation:Optional404 // (Required) Password for the database access. This is a block with a single field named `raw` which should contain the password.405 Password []MongoTargetConnectionConnectionOptionsPasswordParameters `json:"password,omitempty" tf:"password,omitempty"`406 // +kubebuilder:validation:Optional407 // (Required) User for the database access.408 User *string `json:"user,omitempty" tf:"user,omitempty"`409}410type MongoTargetConnectionConnectionOptionsPasswordObservation struct {411}412type MongoTargetConnectionConnectionOptionsPasswordParameters struct {413 // +kubebuilder:validation:Optional414 RawSecretRef *v1.SecretKeySelector `json:"rawSecretRef,omitempty" tf:"-"`415}416type MongoTargetConnectionObservation struct {417}418type MongoTargetConnectionParameters struct {419 // +kubebuilder:validation:Optional420 ConnectionOptions []MongoTargetConnectionConnectionOptionsParameters `json:"connectionOptions,omitempty" tf:"connection_options,omitempty"`421}422type MongoTargetObservation struct {423}424type MongoTargetParameters struct {425 // +kubebuilder:validation:Optional426 // (Optional) How to clean collections when activating the transfer. One of "DISABLED", "DROP" or "TRUNCATE".427 CleanupPolicy *string `json:"cleanupPolicy,omitempty" tf:"cleanup_policy,omitempty"`428 // +kubebuilder:validation:Optional429 // (Required) Connection settings. The structure is documented below.430 Connection []MongoTargetConnectionParameters `json:"connection,omitempty" tf:"connection,omitempty"`431 // +kubebuilder:validation:Optional432 // (Required) Name of the database to transfer.433 Database *string `json:"database,omitempty" tf:"database,omitempty"`434 // +kubebuilder:validation:Optional435 // (Optional) List of security groups that the transfer associated with this endpoint should use.436 SecurityGroups []*string `json:"securityGroups,omitempty" tf:"security_groups,omitempty"`437 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/vpc/v1alpha1.Subnet438 // +kubebuilder:validation:Optional439 // (Optional) Identifier of the Yandex Cloud VPC subnetwork to user for accessing the database. If omitted, the server has to be accessible via Internet.440 SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"`441 // +kubebuilder:validation:Optional442 SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"`443 // +kubebuilder:validation:Optional444 SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"`445}446type MySQLSourceConnectionObservation struct {447}448type MySQLSourceConnectionParameters struct {449 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/mdb/v1alpha1.MySQLCluster450 // +kubebuilder:validation:Optional451 // Identifier of the Managed PostgreSQL cluster.452 MdbClusterID *string `json:"mdbClusterId,omitempty" tf:"mdb_cluster_id,omitempty"`453 // +kubebuilder:validation:Optional454 MdbClusterIDRef *v1.Reference `json:"mdbClusterIdRef,omitempty" tf:"-"`455 // +kubebuilder:validation:Optional456 MdbClusterIDSelector *v1.Selector `json:"mdbClusterIdSelector,omitempty" tf:"-"`457 // +kubebuilder:validation:Optional458 // Connection settings of the on-premise PostgreSQL server.459 OnPremise []ConnectionOnPremiseParameters `json:"onPremise,omitempty" tf:"on_premise,omitempty"`460}461type MySQLSourceObservation struct {462}463type MySQLSourceParameters struct {464 // +kubebuilder:validation:Optional465 // (Required) Connection settings. The structure is documented below.466 Connection []MySQLSourceConnectionParameters `json:"connection,omitempty" tf:"connection,omitempty"`467 // +kubebuilder:validation:Optional468 // (Required) Name of the database to transfer.469 Database *string `json:"database,omitempty" tf:"database,omitempty"`470 // +kubebuilder:validation:Optional471 // (Optional) Opposite of `include_table_regex`. The tables matching the specified regular expressions will not be transferred.472 ExcludeTablesRegex []*string `json:"excludeTablesRegex,omitempty" tf:"exclude_tables_regex,omitempty"`473 // +kubebuilder:validation:Optional474 // (Optional) List of regular expressions of table names which should be transferred. A table name is formatted as schemaname.tablename. For example, a single regular expression may look like `^mydb.employees$`.475 IncludeTablesRegex []*string `json:"includeTablesRegex,omitempty" tf:"include_tables_regex,omitempty"`476 // +kubebuilder:validation:Optional477 // (Optional) Defines which database schema objects should be transferred, e.g. views, functions, etc.478 ObjectTransferSettings []ObjectTransferSettingsParameters `json:"objectTransferSettings,omitempty" tf:"object_transfer_settings,omitempty"`479 // +kubebuilder:validation:Optional480 // (Required) Password for the database access. This is a block with a single field named `raw` which should contain the password.481 Password []MySQLSourcePasswordParameters `json:"password,omitempty" tf:"password,omitempty"`482 // +kubebuilder:validation:Optional483 // (Optional) List of security groups that the transfer associated with this endpoint should use.484 SecurityGroups []*string `json:"securityGroups,omitempty" tf:"security_groups,omitempty"`485 // +kubebuilder:validation:Optional486 ServiceDatabase *string `json:"serviceDatabase,omitempty" tf:"service_database,omitempty"`487 // +kubebuilder:validation:Optional488 // (Optional) Timezone to use for parsing timestamps for saving source timezones. Accepts values from IANA timezone database. Default: local timezone.489 Timezone *string `json:"timezone,omitempty" tf:"timezone,omitempty"`490 // +kubebuilder:validation:Optional491 // (Required) User for the database access.492 User *string `json:"user,omitempty" tf:"user,omitempty"`493}494type MySQLSourcePasswordObservation struct {495}496type MySQLSourcePasswordParameters struct {497 // +kubebuilder:validation:Optional498 RawSecretRef *v1.SecretKeySelector `json:"rawSecretRef,omitempty" tf:"-"`499}500type MySQLTargetConnectionObservation struct {501}502type MySQLTargetConnectionOnPremiseObservation struct {503}504type MySQLTargetConnectionOnPremiseParameters struct {505 // +kubebuilder:validation:Optional506 // (Required) List of host names of the PostgreSQL server. Exactly one host is expected currently.507 Hosts []*string `json:"hosts,omitempty" tf:"hosts,omitempty"`508 // +kubebuilder:validation:Optional509 // (Required) Port for the database connection.510 Port *float64 `json:"port,omitempty" tf:"port,omitempty"`511 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/vpc/v1alpha1.Subnet512 // +kubebuilder:validation:Optional513 // (Optional) Identifier of the Yandex Cloud VPC subnetwork to user for accessing the database. If omitted, the server has to be accessible via Internet.514 SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"`515 // +kubebuilder:validation:Optional516 SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"`517 // +kubebuilder:validation:Optional518 SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"`519 // +kubebuilder:validation:Optional520 // (Optional) TLS settings for the server connection. Empty implies plaintext connection. The structure is documented below.521 TLSMode []MySQLTargetConnectionOnPremiseTLSModeParameters `json:"tlsMode,omitempty" tf:"tls_mode,omitempty"`522}523type MySQLTargetConnectionOnPremiseTLSModeDisabledObservation struct {524}525type MySQLTargetConnectionOnPremiseTLSModeDisabledParameters struct {526}527type MySQLTargetConnectionOnPremiseTLSModeEnabledObservation struct {528}529type MySQLTargetConnectionOnPremiseTLSModeEnabledParameters struct {530 // +kubebuilder:validation:Optional531 // (Optional) X.509 certificate of the certificate authority which issued the server's certificate, in PEM format. If empty, the server's certificate must be signed by a well-known CA.532 CACertificate *string `json:"caCertificate,omitempty" tf:"ca_certificate,omitempty"`533}534type MySQLTargetConnectionOnPremiseTLSModeObservation struct {535}536type MySQLTargetConnectionOnPremiseTLSModeParameters struct {537 // +kubebuilder:validation:Optional538 // Empty block designating that the connection is not secured, i.e. plaintext connection.539 Disabled []MySQLTargetConnectionOnPremiseTLSModeDisabledParameters `json:"disabled,omitempty" tf:"disabled,omitempty"`540 // +kubebuilder:validation:Optional541 // If this attribute is not an empty block, then TLS is used for the server connection. The structure is documented below.542 Enabled []MySQLTargetConnectionOnPremiseTLSModeEnabledParameters `json:"enabled,omitempty" tf:"enabled,omitempty"`543}544type MySQLTargetConnectionParameters struct {545 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/mdb/v1alpha1.MySQLCluster546 // +kubebuilder:validation:Optional547 // Identifier of the Managed PostgreSQL cluster.548 MdbClusterID *string `json:"mdbClusterId,omitempty" tf:"mdb_cluster_id,omitempty"`549 // +kubebuilder:validation:Optional550 MdbClusterIDRef *v1.Reference `json:"mdbClusterIdRef,omitempty" tf:"-"`551 // +kubebuilder:validation:Optional552 MdbClusterIDSelector *v1.Selector `json:"mdbClusterIdSelector,omitempty" tf:"-"`553 // +kubebuilder:validation:Optional554 // Connection settings of the on-premise PostgreSQL server.555 OnPremise []MySQLTargetConnectionOnPremiseParameters `json:"onPremise,omitempty" tf:"on_premise,omitempty"`556}557type MySQLTargetObservation struct {558}559type MySQLTargetParameters struct {560 // +kubebuilder:validation:Optional561 // (Required) Connection settings. The structure is documented below.562 Connection []MySQLTargetConnectionParameters `json:"connection,omitempty" tf:"connection,omitempty"`563 // +kubebuilder:validation:Optional564 // (Required) Name of the database to transfer.565 Database *string `json:"database,omitempty" tf:"database,omitempty"`566 // +kubebuilder:validation:Optional567 // (Required) Password for the database access. This is a block with a single field named `raw` which should contain the password.568 Password []MySQLTargetPasswordParameters `json:"password,omitempty" tf:"password,omitempty"`569 // +kubebuilder:validation:Optional570 // (Optional) [sql_mode](https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html) to use when interacting with the server. Defaults to "NO_AUTO_VALUE_ON_ZERO,NO_DIR_IN_CREATE,NO_ENGINE_SUBSTITUTION".571 SQLMode *string `json:"sqlMode,omitempty" tf:"sql_mode,omitempty"`572 // +kubebuilder:validation:Optional573 // (Optional) List of security groups that the transfer associated with this endpoint should use.574 SecurityGroups []*string `json:"securityGroups,omitempty" tf:"security_groups,omitempty"`575 // +kubebuilder:validation:Optional576 // (Optional) When true, disables foreign key checks. See [foreign_key_checks](https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_foreign_key_checks). False by default.577 SkipConstraintChecks *bool `json:"skipConstraintChecks,omitempty" tf:"skip_constraint_checks,omitempty"`578 // +kubebuilder:validation:Optional579 // (Optional) Timezone to use for parsing timestamps for saving source timezones. Accepts values from IANA timezone database. Default: local timezone.580 Timezone *string `json:"timezone,omitempty" tf:"timezone,omitempty"`581 // +kubebuilder:validation:Optional582 // (Required) User for the database access.583 User *string `json:"user,omitempty" tf:"user,omitempty"`584}585type MySQLTargetPasswordObservation struct {586}587type MySQLTargetPasswordParameters struct {588 // +kubebuilder:validation:Optional589 RawSecretRef *v1.SecretKeySelector `json:"rawSecretRef,omitempty" tf:"-"`590}591type ObjectTransferSettingsObservation struct {592}593type ObjectTransferSettingsParameters struct {594 // +kubebuilder:validation:Optional595 Routine *string `json:"routine,omitempty" tf:"routine,omitempty"`596 // +kubebuilder:validation:Optional597 Trigger *string `json:"trigger,omitempty" tf:"trigger,omitempty"`598 // +kubebuilder:validation:Optional599 View *string `json:"view,omitempty" tf:"view,omitempty"`600}601type OnPremiseObservation struct {602}603type OnPremiseParameters struct {604 // +kubebuilder:validation:Optional605 // (Required) TCP port number for the HTTP interface of the ClickHouse server.606 HTTPPort *float64 `json:"httpPort,omitempty" tf:"http_port,omitempty"`607 // +kubebuilder:validation:Optional608 // (Required) TCP port number for the native interface of the ClickHouse server.609 NativePort *float64 `json:"nativePort,omitempty" tf:"native_port,omitempty"`610 // +kubebuilder:validation:Optional611 // (Required) The list of ClickHouse shards. The structure is documented below.612 Shards []ShardsParameters `json:"shards,omitempty" tf:"shards,omitempty"`613 // +kubebuilder:validation:Optional614 // (Optional) TLS settings for the server connection. Empty implies plaintext connection. The structure is documented below.615 TLSMode []TLSModeParameters `json:"tlsMode,omitempty" tf:"tls_mode,omitempty"`616}617type OnPremiseShardsObservation struct {618}619type OnPremiseShardsParameters struct {620 // +kubebuilder:validation:Optional621 // (Required) List of host names of the PostgreSQL server. Exactly one host is expected currently.622 Hosts []*string `json:"hosts,omitempty" tf:"hosts,omitempty"`623 // +kubebuilder:validation:Optional624 // (Required) Name of the endpoint.625 Name *string `json:"name,omitempty" tf:"name,omitempty"`626}627type OnPremiseTLSModeDisabledObservation struct {628}629type OnPremiseTLSModeDisabledParameters struct {630}631type OnPremiseTLSModeEnabledObservation struct {632}633type OnPremiseTLSModeEnabledParameters struct {634 // +kubebuilder:validation:Optional635 // (Optional) X.509 certificate of the certificate authority which issued the server's certificate, in PEM format. If empty, the server's certificate must be signed by a well-known CA.636 CACertificate *string `json:"caCertificate,omitempty" tf:"ca_certificate,omitempty"`637}638type OnPremiseTLSModeObservation struct {639}640type OnPremiseTLSModeParameters struct {641 // +kubebuilder:validation:Optional642 // Empty block designating that the connection is not secured, i.e. plaintext connection.643 Disabled []TLSModeDisabledParameters `json:"disabled,omitempty" tf:"disabled,omitempty"`644 // +kubebuilder:validation:Optional645 // If this attribute is not an empty block, then TLS is used for the server connection. The structure is documented below.646 Enabled []TLSModeEnabledParameters `json:"enabled,omitempty" tf:"enabled,omitempty"`647}648type PasswordObservation struct {649}650type PasswordParameters struct {651 // +kubebuilder:validation:Optional652 RawSecretRef *v1.SecretKeySelector `json:"rawSecretRef,omitempty" tf:"-"`653}654type PostgresSourceConnectionObservation struct {655}656type PostgresSourceConnectionOnPremiseObservation struct {657}658type PostgresSourceConnectionOnPremiseParameters struct {659 // +kubebuilder:validation:Optional660 // (Required) List of host names of the PostgreSQL server. Exactly one host is expected currently.661 Hosts []*string `json:"hosts,omitempty" tf:"hosts,omitempty"`662 // +kubebuilder:validation:Optional663 // (Required) Port for the database connection.664 Port *float64 `json:"port,omitempty" tf:"port,omitempty"`665 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/vpc/v1alpha1.Subnet666 // +kubebuilder:validation:Optional667 // (Optional) Identifier of the Yandex Cloud VPC subnetwork to user for accessing the database. If omitted, the server has to be accessible via Internet.668 SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"`669 // +kubebuilder:validation:Optional670 SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"`671 // +kubebuilder:validation:Optional672 SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"`673 // +kubebuilder:validation:Optional674 // (Optional) TLS settings for the server connection. Empty implies plaintext connection. The structure is documented below.675 TLSMode []PostgresSourceConnectionOnPremiseTLSModeParameters `json:"tlsMode,omitempty" tf:"tls_mode,omitempty"`676}677type PostgresSourceConnectionOnPremiseTLSModeDisabledObservation struct {678}679type PostgresSourceConnectionOnPremiseTLSModeDisabledParameters struct {680}681type PostgresSourceConnectionOnPremiseTLSModeEnabledObservation struct {682}683type PostgresSourceConnectionOnPremiseTLSModeEnabledParameters struct {684 // +kubebuilder:validation:Optional685 // (Optional) X.509 certificate of the certificate authority which issued the server's certificate, in PEM format. If empty, the server's certificate must be signed by a well-known CA.686 CACertificate *string `json:"caCertificate,omitempty" tf:"ca_certificate,omitempty"`687}688type PostgresSourceConnectionOnPremiseTLSModeObservation struct {689}690type PostgresSourceConnectionOnPremiseTLSModeParameters struct {691 // +kubebuilder:validation:Optional692 // Empty block designating that the connection is not secured, i.e. plaintext connection.693 Disabled []PostgresSourceConnectionOnPremiseTLSModeDisabledParameters `json:"disabled,omitempty" tf:"disabled,omitempty"`694 // +kubebuilder:validation:Optional695 // If this attribute is not an empty block, then TLS is used for the server connection. The structure is documented below.696 Enabled []PostgresSourceConnectionOnPremiseTLSModeEnabledParameters `json:"enabled,omitempty" tf:"enabled,omitempty"`697}698type PostgresSourceConnectionParameters struct {699 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/mdb/v1alpha1.PostgresqlCluster700 // +kubebuilder:validation:Optional701 // Identifier of the Managed PostgreSQL cluster.702 MdbClusterID *string `json:"mdbClusterId,omitempty" tf:"mdb_cluster_id,omitempty"`703 // +kubebuilder:validation:Optional704 MdbClusterIDRef *v1.Reference `json:"mdbClusterIdRef,omitempty" tf:"-"`705 // +kubebuilder:validation:Optional706 MdbClusterIDSelector *v1.Selector `json:"mdbClusterIdSelector,omitempty" tf:"-"`707 // +kubebuilder:validation:Optional708 // Connection settings of the on-premise PostgreSQL server.709 OnPremise []PostgresSourceConnectionOnPremiseParameters `json:"onPremise,omitempty" tf:"on_premise,omitempty"`710}711type PostgresSourceObjectTransferSettingsObservation struct {712}713type PostgresSourceObjectTransferSettingsParameters struct {714 // +kubebuilder:validation:Optional715 Cast *string `json:"cast,omitempty" tf:"cast,omitempty"`716 // +kubebuilder:validation:Optional717 Collation *string `json:"collation,omitempty" tf:"collation,omitempty"`718 // +kubebuilder:validation:Optional719 Constraint *string `json:"constraint,omitempty" tf:"constraint,omitempty"`720 // +kubebuilder:validation:Optional721 DefaultValues *string `json:"defaultValues,omitempty" tf:"default_values,omitempty"`722 // +kubebuilder:validation:Optional723 FkConstraint *string `json:"fkConstraint,omitempty" tf:"fk_constraint,omitempty"`724 // +kubebuilder:validation:Optional725 Function *string `json:"function,omitempty" tf:"function,omitempty"`726 // +kubebuilder:validation:Optional727 Index *string `json:"index,omitempty" tf:"index,omitempty"`728 // +kubebuilder:validation:Optional729 MaterializedView *string `json:"materializedView,omitempty" tf:"materialized_view,omitempty"`730 // +kubebuilder:validation:Optional731 Policy *string `json:"policy,omitempty" tf:"policy,omitempty"`732 // +kubebuilder:validation:Optional733 PrimaryKey *string `json:"primaryKey,omitempty" tf:"primary_key,omitempty"`734 // +kubebuilder:validation:Optional735 Rule *string `json:"rule,omitempty" tf:"rule,omitempty"`736 // +kubebuilder:validation:Optional737 Sequence *string `json:"sequence,omitempty" tf:"sequence,omitempty"`738 // +kubebuilder:validation:Optional739 SequenceOwnedBy *string `json:"sequenceOwnedBy,omitempty" tf:"sequence_owned_by,omitempty"`740 // +kubebuilder:validation:Optional741 Table *string `json:"table,omitempty" tf:"table,omitempty"`742 // +kubebuilder:validation:Optional743 Trigger *string `json:"trigger,omitempty" tf:"trigger,omitempty"`744 // +kubebuilder:validation:Optional745 Type *string `json:"type,omitempty" tf:"type,omitempty"`746 // +kubebuilder:validation:Optional747 View *string `json:"view,omitempty" tf:"view,omitempty"`748}749type PostgresSourceObservation struct {750}751type PostgresSourceParameters struct {752 // +kubebuilder:validation:Optional753 // (Required) Connection settings. The structure is documented below.754 Connection []PostgresSourceConnectionParameters `json:"connection,omitempty" tf:"connection,omitempty"`755 // +kubebuilder:validation:Optional756 // (Required) Name of the database to transfer.757 Database *string `json:"database,omitempty" tf:"database,omitempty"`758 // +kubebuilder:validation:Optional759 // List of tables which will not be transfered, formatted as `schemaname.tablename`.760 ExcludeTables []*string `json:"excludeTables,omitempty" tf:"exclude_tables,omitempty"`761 // +kubebuilder:validation:Optional762 // List of tables to transfer, formatted as `schemaname.tablename`. If omitted or an empty list is specified, all tables will be transferred.763 IncludeTables []*string `json:"includeTables,omitempty" tf:"include_tables,omitempty"`764 // +kubebuilder:validation:Optional765 // (Optional) Defines which database schema objects should be transferred, e.g. views, functions, etc.766 ObjectTransferSettings []PostgresSourceObjectTransferSettingsParameters `json:"objectTransferSettings,omitempty" tf:"object_transfer_settings,omitempty"`767 // +kubebuilder:validation:Optional768 // (Required) Password for the database access. This is a block with a single field named `raw` which should contain the password.769 Password []PostgresSourcePasswordParameters `json:"password,omitempty" tf:"password,omitempty"`770 // +kubebuilder:validation:Optional771 // (Optional) List of security groups that the transfer associated with this endpoint should use.772 SecurityGroups []*string `json:"securityGroups,omitempty" tf:"security_groups,omitempty"`773 // +kubebuilder:validation:Optional774 // (Optional) Name of the database schema in which auxiliary tables needed for the transfer will be created. Empty `service_schema` implies schema "public".775 ServiceSchema *string `json:"serviceSchema,omitempty" tf:"service_schema,omitempty"`776 // +kubebuilder:validation:Optional777 // (Optional) Maximum WAL size held by the replication slot, in gigabytes. Exceeding this limit will result in a replication failure and deletion of the replication slot. Unlimited by default.778 SlotGigabyteLagLimit *float64 `json:"slotGigabyteLagLimit,omitempty" tf:"slot_gigabyte_lag_limit,omitempty"`779 // +kubebuilder:validation:Optional780 // (Required) User for the database access.781 User *string `json:"user,omitempty" tf:"user,omitempty"`782}783type PostgresSourcePasswordObservation struct {784}785type PostgresSourcePasswordParameters struct {786 // +kubebuilder:validation:Optional787 RawSecretRef *v1.SecretKeySelector `json:"rawSecretRef,omitempty" tf:"-"`788}789type PostgresTargetConnectionObservation struct {790}791type PostgresTargetConnectionOnPremiseObservation struct {792}793type PostgresTargetConnectionOnPremiseParameters struct {794 // +kubebuilder:validation:Optional795 // (Required) List of host names of the PostgreSQL server. Exactly one host is expected currently.796 Hosts []*string `json:"hosts,omitempty" tf:"hosts,omitempty"`797 // +kubebuilder:validation:Optional798 // (Required) Port for the database connection.799 Port *float64 `json:"port,omitempty" tf:"port,omitempty"`800 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/vpc/v1alpha1.Subnet801 // +kubebuilder:validation:Optional802 // (Optional) Identifier of the Yandex Cloud VPC subnetwork to user for accessing the database. If omitted, the server has to be accessible via Internet.803 SubnetID *string `json:"subnetId,omitempty" tf:"subnet_id,omitempty"`804 // +kubebuilder:validation:Optional805 SubnetIDRef *v1.Reference `json:"subnetIdRef,omitempty" tf:"-"`806 // +kubebuilder:validation:Optional807 SubnetIDSelector *v1.Selector `json:"subnetIdSelector,omitempty" tf:"-"`808 // +kubebuilder:validation:Optional809 // (Optional) TLS settings for the server connection. Empty implies plaintext connection. The structure is documented below.810 TLSMode []PostgresTargetConnectionOnPremiseTLSModeParameters `json:"tlsMode,omitempty" tf:"tls_mode,omitempty"`811}812type PostgresTargetConnectionOnPremiseTLSModeDisabledObservation struct {813}814type PostgresTargetConnectionOnPremiseTLSModeDisabledParameters struct {815}816type PostgresTargetConnectionOnPremiseTLSModeEnabledObservation struct {817}818type PostgresTargetConnectionOnPremiseTLSModeEnabledParameters struct {819 // +kubebuilder:validation:Optional820 // (Optional) X.509 certificate of the certificate authority which issued the server's certificate, in PEM format. If empty, the server's certificate must be signed by a well-known CA.821 CACertificate *string `json:"caCertificate,omitempty" tf:"ca_certificate,omitempty"`822}823type PostgresTargetConnectionOnPremiseTLSModeObservation struct {824}825type PostgresTargetConnectionOnPremiseTLSModeParameters struct {826 // +kubebuilder:validation:Optional827 // Empty block designating that the connection is not secured, i.e. plaintext connection.828 Disabled []PostgresTargetConnectionOnPremiseTLSModeDisabledParameters `json:"disabled,omitempty" tf:"disabled,omitempty"`829 // +kubebuilder:validation:Optional830 // If this attribute is not an empty block, then TLS is used for the server connection. The structure is documented below.831 Enabled []PostgresTargetConnectionOnPremiseTLSModeEnabledParameters `json:"enabled,omitempty" tf:"enabled,omitempty"`832}833type PostgresTargetConnectionParameters struct {834 // +crossplane:generate:reference:type=github.com/yandex-cloud/provider-jet-yc/apis/mdb/v1alpha1.PostgresqlCluster835 // +kubebuilder:validation:Optional836 // Identifier of the Managed PostgreSQL cluster.837 MdbClusterID *string `json:"mdbClusterId,omitempty" tf:"mdb_cluster_id,omitempty"`838 // +kubebuilder:validation:Optional839 MdbClusterIDRef *v1.Reference `json:"mdbClusterIdRef,omitempty" tf:"-"`840 // +kubebuilder:validation:Optional841 MdbClusterIDSelector *v1.Selector `json:"mdbClusterIdSelector,omitempty" tf:"-"`842 // +kubebuilder:validation:Optional843 // Connection settings of the on-premise PostgreSQL server.844 OnPremise []PostgresTargetConnectionOnPremiseParameters `json:"onPremise,omitempty" tf:"on_premise,omitempty"`845}846type PostgresTargetObservation struct {847}848type PostgresTargetParameters struct {849 // +kubebuilder:validation:Optional850 // (Required) Connection settings. The structure is documented below.851 Connection []PostgresTargetConnectionParameters `json:"connection,omitempty" tf:"connection,omitempty"`852 // +kubebuilder:validation:Optional853 // (Required) Name of the database to transfer.854 Database *string `json:"database,omitempty" tf:"database,omitempty"`855 // +kubebuilder:validation:Optional856 // (Required) Password for the database access. This is a block with a single field named `raw` which should contain the password.857 Password []PostgresTargetPasswordParameters `json:"password,omitempty" tf:"password,omitempty"`858 // +kubebuilder:validation:Optional859 // (Optional) List of security groups that the transfer associated with this endpoint should use.860 SecurityGroups []*string `json:"securityGroups,omitempty" tf:"security_groups,omitempty"`861 // +kubebuilder:validation:Optional862 // (Required) User for the database access.863 User *string `json:"user,omitempty" tf:"user,omitempty"`864}865type PostgresTargetPasswordObservation struct {...

Full Screen

Full Screen

botconnection.go

Source:botconnection.go Github

copy

Full Screen

...22 "github.com/Azure/go-autorest/autorest/validation"23 "github.com/Azure/go-autorest/tracing"24 "net/http"25)26// BotConnectionClient is the azure Bot Service is a platform for creating smart conversational agents.27type BotConnectionClient struct {28 BaseClient29}30// NewBotConnectionClient creates an instance of the BotConnectionClient client.31func NewBotConnectionClient(subscriptionID string) BotConnectionClient {32 return NewBotConnectionClientWithBaseURI(DefaultBaseURI, subscriptionID)33}34// NewBotConnectionClientWithBaseURI creates an instance of the BotConnectionClient client using a custom endpoint.35// Use this when interacting with an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack).36func NewBotConnectionClientWithBaseURI(baseURI string, subscriptionID string) BotConnectionClient {37 return BotConnectionClient{NewWithBaseURI(baseURI, subscriptionID)}38}39// Create register a new Auth Connection for a Bot Service40// Parameters:41// resourceGroupName - the name of the Bot resource group in the user subscription.42// resourceName - the name of the Bot resource.43// connectionName - the name of the Bot Service Connection Setting resource44// parameters - the parameters to provide for creating the Connection Setting.45func (client BotConnectionClient) Create(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters ConnectionSetting) (result ConnectionSetting, err error) {46 if tracing.IsEnabled() {47 ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.Create")48 defer func() {49 sc := -150 if result.Response.Response != nil {51 sc = result.Response.Response.StatusCode52 }53 tracing.EndSpan(ctx, sc, err)54 }()55 }56 if err := validation.Validate([]validation.Validation{57 {TargetValue: resourceGroupName,58 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},59 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil},60 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},61 {TargetValue: resourceName,62 Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil},63 {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil},64 {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},65 {TargetValue: connectionName,66 Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil},67 {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil},68 {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {69 return result, validation.NewError("botservice.BotConnectionClient", "Create", err.Error())70 }71 req, err := client.CreatePreparer(ctx, resourceGroupName, resourceName, connectionName, parameters)72 if err != nil {73 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Create", nil, "Failure preparing request")74 return75 }76 resp, err := client.CreateSender(req)77 if err != nil {78 result.Response = autorest.Response{Response: resp}79 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Create", resp, "Failure sending request")80 return81 }82 result, err = client.CreateResponder(resp)83 if err != nil {84 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Create", resp, "Failure responding to request")85 }86 return87}88// CreatePreparer prepares the Create request.89func (client BotConnectionClient) CreatePreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters ConnectionSetting) (*http.Request, error) {90 pathParameters := map[string]interface{}{91 "connectionName": autorest.Encode("path", connectionName),92 "resourceGroupName": autorest.Encode("path", resourceGroupName),93 "resourceName": autorest.Encode("path", resourceName),94 "subscriptionId": autorest.Encode("path", client.SubscriptionID),95 }96 const APIVersion = "2017-12-01"97 queryParameters := map[string]interface{}{98 "api-version": APIVersion,99 }100 preparer := autorest.CreatePreparer(101 autorest.AsContentType("application/json; charset=utf-8"),102 autorest.AsPut(),103 autorest.WithBaseURL(client.BaseURI),104 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/Connections/{connectionName}", pathParameters),105 autorest.WithJSON(parameters),106 autorest.WithQueryParameters(queryParameters))107 return preparer.Prepare((&http.Request{}).WithContext(ctx))108}109// CreateSender sends the Create request. The method will close the110// http.Response Body if it receives an error.111func (client BotConnectionClient) CreateSender(req *http.Request) (*http.Response, error) {112 return client.Send(req, azure.DoRetryWithRegistration(client.Client))113}114// CreateResponder handles the response to the Create request. The method always115// closes the http.Response Body.116func (client BotConnectionClient) CreateResponder(resp *http.Response) (result ConnectionSetting, err error) {117 err = autorest.Respond(118 resp,119 client.ByInspecting(),120 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),121 autorest.ByUnmarshallingJSON(&result),122 autorest.ByClosing())123 result.Response = autorest.Response{Response: resp}124 return125}126// Delete deletes a Connection Setting registration for a Bot Service127// Parameters:128// resourceGroupName - the name of the Bot resource group in the user subscription.129// resourceName - the name of the Bot resource.130// connectionName - the name of the Bot Service Connection Setting resource131func (client BotConnectionClient) Delete(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result autorest.Response, err error) {132 if tracing.IsEnabled() {133 ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.Delete")134 defer func() {135 sc := -1136 if result.Response != nil {137 sc = result.Response.StatusCode138 }139 tracing.EndSpan(ctx, sc, err)140 }()141 }142 if err := validation.Validate([]validation.Validation{143 {TargetValue: resourceGroupName,144 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},145 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil},146 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},147 {TargetValue: resourceName,148 Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil},149 {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil},150 {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},151 {TargetValue: connectionName,152 Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil},153 {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil},154 {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {155 return result, validation.NewError("botservice.BotConnectionClient", "Delete", err.Error())156 }157 req, err := client.DeletePreparer(ctx, resourceGroupName, resourceName, connectionName)158 if err != nil {159 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Delete", nil, "Failure preparing request")160 return161 }162 resp, err := client.DeleteSender(req)163 if err != nil {164 result.Response = resp165 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Delete", resp, "Failure sending request")166 return167 }168 result, err = client.DeleteResponder(resp)169 if err != nil {170 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Delete", resp, "Failure responding to request")171 }172 return173}174// DeletePreparer prepares the Delete request.175func (client BotConnectionClient) DeletePreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (*http.Request, error) {176 pathParameters := map[string]interface{}{177 "connectionName": autorest.Encode("path", connectionName),178 "resourceGroupName": autorest.Encode("path", resourceGroupName),179 "resourceName": autorest.Encode("path", resourceName),180 "subscriptionId": autorest.Encode("path", client.SubscriptionID),181 }182 const APIVersion = "2017-12-01"183 queryParameters := map[string]interface{}{184 "api-version": APIVersion,185 }186 preparer := autorest.CreatePreparer(187 autorest.AsDelete(),188 autorest.WithBaseURL(client.BaseURI),189 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/Connections/{connectionName}", pathParameters),190 autorest.WithQueryParameters(queryParameters))191 return preparer.Prepare((&http.Request{}).WithContext(ctx))192}193// DeleteSender sends the Delete request. The method will close the194// http.Response Body if it receives an error.195func (client BotConnectionClient) DeleteSender(req *http.Request) (*http.Response, error) {196 return client.Send(req, azure.DoRetryWithRegistration(client.Client))197}198// DeleteResponder handles the response to the Delete request. The method always199// closes the http.Response Body.200func (client BotConnectionClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {201 err = autorest.Respond(202 resp,203 client.ByInspecting(),204 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusNoContent),205 autorest.ByClosing())206 result.Response = resp207 return208}209// Get get a Connection Setting registration for a Bot Service210// Parameters:211// resourceGroupName - the name of the Bot resource group in the user subscription.212// resourceName - the name of the Bot resource.213// connectionName - the name of the Bot Service Connection Setting resource214func (client BotConnectionClient) Get(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result ConnectionSetting, err error) {215 if tracing.IsEnabled() {216 ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.Get")217 defer func() {218 sc := -1219 if result.Response.Response != nil {220 sc = result.Response.Response.StatusCode221 }222 tracing.EndSpan(ctx, sc, err)223 }()224 }225 if err := validation.Validate([]validation.Validation{226 {TargetValue: resourceGroupName,227 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},228 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil},229 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},230 {TargetValue: resourceName,231 Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil},232 {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil},233 {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},234 {TargetValue: connectionName,235 Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil},236 {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil},237 {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {238 return result, validation.NewError("botservice.BotConnectionClient", "Get", err.Error())239 }240 req, err := client.GetPreparer(ctx, resourceGroupName, resourceName, connectionName)241 if err != nil {242 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Get", nil, "Failure preparing request")243 return244 }245 resp, err := client.GetSender(req)246 if err != nil {247 result.Response = autorest.Response{Response: resp}248 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Get", resp, "Failure sending request")249 return250 }251 result, err = client.GetResponder(resp)252 if err != nil {253 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Get", resp, "Failure responding to request")254 }255 return256}257// GetPreparer prepares the Get request.258func (client BotConnectionClient) GetPreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (*http.Request, error) {259 pathParameters := map[string]interface{}{260 "connectionName": autorest.Encode("path", connectionName),261 "resourceGroupName": autorest.Encode("path", resourceGroupName),262 "resourceName": autorest.Encode("path", resourceName),263 "subscriptionId": autorest.Encode("path", client.SubscriptionID),264 }265 const APIVersion = "2017-12-01"266 queryParameters := map[string]interface{}{267 "api-version": APIVersion,268 }269 preparer := autorest.CreatePreparer(270 autorest.AsGet(),271 autorest.WithBaseURL(client.BaseURI),272 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/Connections/{connectionName}", pathParameters),273 autorest.WithQueryParameters(queryParameters))274 return preparer.Prepare((&http.Request{}).WithContext(ctx))275}276// GetSender sends the Get request. The method will close the277// http.Response Body if it receives an error.278func (client BotConnectionClient) GetSender(req *http.Request) (*http.Response, error) {279 return client.Send(req, azure.DoRetryWithRegistration(client.Client))280}281// GetResponder handles the response to the Get request. The method always282// closes the http.Response Body.283func (client BotConnectionClient) GetResponder(resp *http.Response) (result ConnectionSetting, err error) {284 err = autorest.Respond(285 resp,286 client.ByInspecting(),287 azure.WithErrorUnlessStatusCode(http.StatusOK),288 autorest.ByUnmarshallingJSON(&result),289 autorest.ByClosing())290 result.Response = autorest.Response{Response: resp}291 return292}293// ListByBotService returns all the Connection Settings registered to a particular BotService resource294// Parameters:295// resourceGroupName - the name of the Bot resource group in the user subscription.296// resourceName - the name of the Bot resource.297func (client BotConnectionClient) ListByBotService(ctx context.Context, resourceGroupName string, resourceName string) (result ConnectionSettingResponseListPage, err error) {298 if tracing.IsEnabled() {299 ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.ListByBotService")300 defer func() {301 sc := -1302 if result.csrl.Response.Response != nil {303 sc = result.csrl.Response.Response.StatusCode304 }305 tracing.EndSpan(ctx, sc, err)306 }()307 }308 if err := validation.Validate([]validation.Validation{309 {TargetValue: resourceGroupName,310 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},311 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil},312 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},313 {TargetValue: resourceName,314 Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil},315 {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil},316 {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {317 return result, validation.NewError("botservice.BotConnectionClient", "ListByBotService", err.Error())318 }319 result.fn = client.listByBotServiceNextResults320 req, err := client.ListByBotServicePreparer(ctx, resourceGroupName, resourceName)321 if err != nil {322 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListByBotService", nil, "Failure preparing request")323 return324 }325 resp, err := client.ListByBotServiceSender(req)326 if err != nil {327 result.csrl.Response = autorest.Response{Response: resp}328 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListByBotService", resp, "Failure sending request")329 return330 }331 result.csrl, err = client.ListByBotServiceResponder(resp)332 if err != nil {333 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListByBotService", resp, "Failure responding to request")334 }335 return336}337// ListByBotServicePreparer prepares the ListByBotService request.338func (client BotConnectionClient) ListByBotServicePreparer(ctx context.Context, resourceGroupName string, resourceName string) (*http.Request, error) {339 pathParameters := map[string]interface{}{340 "resourceGroupName": autorest.Encode("path", resourceGroupName),341 "resourceName": autorest.Encode("path", resourceName),342 "subscriptionId": autorest.Encode("path", client.SubscriptionID),343 }344 const APIVersion = "2017-12-01"345 queryParameters := map[string]interface{}{346 "api-version": APIVersion,347 }348 preparer := autorest.CreatePreparer(349 autorest.AsGet(),350 autorest.WithBaseURL(client.BaseURI),351 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/connections", pathParameters),352 autorest.WithQueryParameters(queryParameters))353 return preparer.Prepare((&http.Request{}).WithContext(ctx))354}355// ListByBotServiceSender sends the ListByBotService request. The method will close the356// http.Response Body if it receives an error.357func (client BotConnectionClient) ListByBotServiceSender(req *http.Request) (*http.Response, error) {358 return client.Send(req, azure.DoRetryWithRegistration(client.Client))359}360// ListByBotServiceResponder handles the response to the ListByBotService request. The method always361// closes the http.Response Body.362func (client BotConnectionClient) ListByBotServiceResponder(resp *http.Response) (result ConnectionSettingResponseList, err error) {363 err = autorest.Respond(364 resp,365 client.ByInspecting(),366 azure.WithErrorUnlessStatusCode(http.StatusOK),367 autorest.ByUnmarshallingJSON(&result),368 autorest.ByClosing())369 result.Response = autorest.Response{Response: resp}370 return371}372// listByBotServiceNextResults retrieves the next set of results, if any.373func (client BotConnectionClient) listByBotServiceNextResults(ctx context.Context, lastResults ConnectionSettingResponseList) (result ConnectionSettingResponseList, err error) {374 req, err := lastResults.connectionSettingResponseListPreparer(ctx)375 if err != nil {376 return result, autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "listByBotServiceNextResults", nil, "Failure preparing next results request")377 }378 if req == nil {379 return380 }381 resp, err := client.ListByBotServiceSender(req)382 if err != nil {383 result.Response = autorest.Response{Response: resp}384 return result, autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "listByBotServiceNextResults", resp, "Failure sending next results request")385 }386 result, err = client.ListByBotServiceResponder(resp)387 if err != nil {388 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "listByBotServiceNextResults", resp, "Failure responding to next results request")389 }390 return391}392// ListByBotServiceComplete enumerates all values, automatically crossing page boundaries as required.393func (client BotConnectionClient) ListByBotServiceComplete(ctx context.Context, resourceGroupName string, resourceName string) (result ConnectionSettingResponseListIterator, err error) {394 if tracing.IsEnabled() {395 ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.ListByBotService")396 defer func() {397 sc := -1398 if result.Response().Response.Response != nil {399 sc = result.page.Response().Response.Response.StatusCode400 }401 tracing.EndSpan(ctx, sc, err)402 }()403 }404 result.page, err = client.ListByBotService(ctx, resourceGroupName, resourceName)405 return406}407// ListServiceProviders lists the available Service Providers for creating Connection Settings408func (client BotConnectionClient) ListServiceProviders(ctx context.Context) (result ServiceProviderResponseList, err error) {409 if tracing.IsEnabled() {410 ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.ListServiceProviders")411 defer func() {412 sc := -1413 if result.Response.Response != nil {414 sc = result.Response.Response.StatusCode415 }416 tracing.EndSpan(ctx, sc, err)417 }()418 }419 req, err := client.ListServiceProvidersPreparer(ctx)420 if err != nil {421 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListServiceProviders", nil, "Failure preparing request")422 return423 }424 resp, err := client.ListServiceProvidersSender(req)425 if err != nil {426 result.Response = autorest.Response{Response: resp}427 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListServiceProviders", resp, "Failure sending request")428 return429 }430 result, err = client.ListServiceProvidersResponder(resp)431 if err != nil {432 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListServiceProviders", resp, "Failure responding to request")433 }434 return435}436// ListServiceProvidersPreparer prepares the ListServiceProviders request.437func (client BotConnectionClient) ListServiceProvidersPreparer(ctx context.Context) (*http.Request, error) {438 pathParameters := map[string]interface{}{439 "subscriptionId": autorest.Encode("path", client.SubscriptionID),440 }441 const APIVersion = "2017-12-01"442 queryParameters := map[string]interface{}{443 "api-version": APIVersion,444 }445 preparer := autorest.CreatePreparer(446 autorest.AsPost(),447 autorest.WithBaseURL(client.BaseURI),448 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.BotService/listAuthServiceProviders", pathParameters),449 autorest.WithQueryParameters(queryParameters))450 return preparer.Prepare((&http.Request{}).WithContext(ctx))451}452// ListServiceProvidersSender sends the ListServiceProviders request. The method will close the453// http.Response Body if it receives an error.454func (client BotConnectionClient) ListServiceProvidersSender(req *http.Request) (*http.Response, error) {455 return client.Send(req, azure.DoRetryWithRegistration(client.Client))456}457// ListServiceProvidersResponder handles the response to the ListServiceProviders request. The method always458// closes the http.Response Body.459func (client BotConnectionClient) ListServiceProvidersResponder(resp *http.Response) (result ServiceProviderResponseList, err error) {460 err = autorest.Respond(461 resp,462 client.ByInspecting(),463 azure.WithErrorUnlessStatusCode(http.StatusOK),464 autorest.ByUnmarshallingJSON(&result),465 autorest.ByClosing())466 result.Response = autorest.Response{Response: resp}467 return468}469// ListWithSecrets get a Connection Setting registration for a Bot Service470// Parameters:471// resourceGroupName - the name of the Bot resource group in the user subscription.472// resourceName - the name of the Bot resource.473// connectionName - the name of the Bot Service Connection Setting resource474func (client BotConnectionClient) ListWithSecrets(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (result ConnectionSetting, err error) {475 if tracing.IsEnabled() {476 ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.ListWithSecrets")477 defer func() {478 sc := -1479 if result.Response.Response != nil {480 sc = result.Response.Response.StatusCode481 }482 tracing.EndSpan(ctx, sc, err)483 }()484 }485 if err := validation.Validate([]validation.Validation{486 {TargetValue: resourceGroupName,487 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},488 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil},489 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},490 {TargetValue: resourceName,491 Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil},492 {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil},493 {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},494 {TargetValue: connectionName,495 Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil},496 {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil},497 {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {498 return result, validation.NewError("botservice.BotConnectionClient", "ListWithSecrets", err.Error())499 }500 req, err := client.ListWithSecretsPreparer(ctx, resourceGroupName, resourceName, connectionName)501 if err != nil {502 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListWithSecrets", nil, "Failure preparing request")503 return504 }505 resp, err := client.ListWithSecretsSender(req)506 if err != nil {507 result.Response = autorest.Response{Response: resp}508 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListWithSecrets", resp, "Failure sending request")509 return510 }511 result, err = client.ListWithSecretsResponder(resp)512 if err != nil {513 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "ListWithSecrets", resp, "Failure responding to request")514 }515 return516}517// ListWithSecretsPreparer prepares the ListWithSecrets request.518func (client BotConnectionClient) ListWithSecretsPreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string) (*http.Request, error) {519 pathParameters := map[string]interface{}{520 "connectionName": autorest.Encode("path", connectionName),521 "resourceGroupName": autorest.Encode("path", resourceGroupName),522 "resourceName": autorest.Encode("path", resourceName),523 "subscriptionId": autorest.Encode("path", client.SubscriptionID),524 }525 const APIVersion = "2017-12-01"526 queryParameters := map[string]interface{}{527 "api-version": APIVersion,528 }529 preparer := autorest.CreatePreparer(530 autorest.AsPost(),531 autorest.WithBaseURL(client.BaseURI),532 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/Connections/{connectionName}/listWithSecrets", pathParameters),533 autorest.WithQueryParameters(queryParameters))534 return preparer.Prepare((&http.Request{}).WithContext(ctx))535}536// ListWithSecretsSender sends the ListWithSecrets request. The method will close the537// http.Response Body if it receives an error.538func (client BotConnectionClient) ListWithSecretsSender(req *http.Request) (*http.Response, error) {539 return client.Send(req, azure.DoRetryWithRegistration(client.Client))540}541// ListWithSecretsResponder handles the response to the ListWithSecrets request. The method always542// closes the http.Response Body.543func (client BotConnectionClient) ListWithSecretsResponder(resp *http.Response) (result ConnectionSetting, err error) {544 err = autorest.Respond(545 resp,546 client.ByInspecting(),547 azure.WithErrorUnlessStatusCode(http.StatusOK),548 autorest.ByUnmarshallingJSON(&result),549 autorest.ByClosing())550 result.Response = autorest.Response{Response: resp}551 return552}553// Update updates a Connection Setting registration for a Bot Service554// Parameters:555// resourceGroupName - the name of the Bot resource group in the user subscription.556// resourceName - the name of the Bot resource.557// connectionName - the name of the Bot Service Connection Setting resource558// parameters - the parameters to provide for updating the Connection Setting.559func (client BotConnectionClient) Update(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters ConnectionSetting) (result ConnectionSetting, err error) {560 if tracing.IsEnabled() {561 ctx = tracing.StartSpan(ctx, fqdn+"/BotConnectionClient.Update")562 defer func() {563 sc := -1564 if result.Response.Response != nil {565 sc = result.Response.Response.StatusCode566 }567 tracing.EndSpan(ctx, sc, err)568 }()569 }570 if err := validation.Validate([]validation.Validation{571 {TargetValue: resourceGroupName,572 Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil},573 {Target: "resourceGroupName", Name: validation.MinLength, Rule: 2, Chain: nil},574 {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},575 {TargetValue: resourceName,576 Constraints: []validation.Constraint{{Target: "resourceName", Name: validation.MaxLength, Rule: 64, Chain: nil},577 {Target: "resourceName", Name: validation.MinLength, Rule: 2, Chain: nil},578 {Target: "resourceName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}},579 {TargetValue: connectionName,580 Constraints: []validation.Constraint{{Target: "connectionName", Name: validation.MaxLength, Rule: 64, Chain: nil},581 {Target: "connectionName", Name: validation.MinLength, Rule: 2, Chain: nil},582 {Target: "connectionName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9_.-]*$`, Chain: nil}}}}); err != nil {583 return result, validation.NewError("botservice.BotConnectionClient", "Update", err.Error())584 }585 req, err := client.UpdatePreparer(ctx, resourceGroupName, resourceName, connectionName, parameters)586 if err != nil {587 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Update", nil, "Failure preparing request")588 return589 }590 resp, err := client.UpdateSender(req)591 if err != nil {592 result.Response = autorest.Response{Response: resp}593 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Update", resp, "Failure sending request")594 return595 }596 result, err = client.UpdateResponder(resp)597 if err != nil {598 err = autorest.NewErrorWithError(err, "botservice.BotConnectionClient", "Update", resp, "Failure responding to request")599 }600 return601}602// UpdatePreparer prepares the Update request.603func (client BotConnectionClient) UpdatePreparer(ctx context.Context, resourceGroupName string, resourceName string, connectionName string, parameters ConnectionSetting) (*http.Request, error) {604 pathParameters := map[string]interface{}{605 "connectionName": autorest.Encode("path", connectionName),606 "resourceGroupName": autorest.Encode("path", resourceGroupName),607 "resourceName": autorest.Encode("path", resourceName),608 "subscriptionId": autorest.Encode("path", client.SubscriptionID),609 }610 const APIVersion = "2017-12-01"611 queryParameters := map[string]interface{}{612 "api-version": APIVersion,613 }614 preparer := autorest.CreatePreparer(615 autorest.AsContentType("application/json; charset=utf-8"),616 autorest.AsPatch(),617 autorest.WithBaseURL(client.BaseURI),618 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.BotService/botServices/{resourceName}/Connections/{connectionName}", pathParameters),619 autorest.WithJSON(parameters),620 autorest.WithQueryParameters(queryParameters))621 return preparer.Prepare((&http.Request{}).WithContext(ctx))622}623// UpdateSender sends the Update request. The method will close the624// http.Response Body if it receives an error.625func (client BotConnectionClient) UpdateSender(req *http.Request) (*http.Response, error) {626 return client.Send(req, azure.DoRetryWithRegistration(client.Client))627}628// UpdateResponder handles the response to the Update request. The method always629// closes the http.Response Body.630func (client BotConnectionClient) UpdateResponder(resp *http.Response) (result ConnectionSetting, err error) {631 err = autorest.Respond(632 resp,633 client.ByInspecting(),634 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated),635 autorest.ByUnmarshallingJSON(&result),636 autorest.ByClosing())637 result.Response = autorest.Response{Response: resp}638 return639}...

Full Screen

Full Screen

config.go

Source:config.go Github

copy

Full Screen

...33 AsTable() template.HTML34}35// ValidationResult contains the results of validating the current configuration.36type ValidationResult struct {37 DatabaseConnection error38 QueryTimeout error39 VisitorQuery error40 VisitorQueryDuration time.Duration41 VisitorQueryResults QueryResult42 RadiologieQuery error43 RadiologieQueryDuration time.Duration44 RadiologieQueryResults QueryResult45 LabQuery error46 LabQueryDuration time.Duration47 LabQueryResults QueryResult48 ConsultQuery error49 ConsultQueryDuration time.Duration50 ConsultQueryResults QueryResult51 D2DConnection error52 D2DCredentials error53 Access error54}55// IsValid returns true if all fatal validation errors are nil.56func (v *ValidationResult) IsValid() bool {57 return v.DatabaseConnection == nil &&58 v.QueryTimeout == nil &&59 v.VisitorQuery == nil &&60 v.D2DConnection == nil &&61 v.D2DCredentials == nil62}63// Configuration contains the configuration options for the service.64type Configuration struct {65 mu sync.RWMutex66 // username to connect to the d2d upload service67 username string68 // password to connect to the d2d upload service69 password string70 // database connection data71 connection db.ConnectionData72 // database timeout73 timeout time.Duration74 // Query to execute to retrieve visitor information75 visitorQuery string76 // Query to execute to retrieve radiologie aanvragen77 radiologieQuery string78 // Query to execute to retrieve lab aanvragen79 labQuery string80 // Query to execute to retrieve intercollegiaal consulten81 consultQuery string82 // Set to true if the service should be active83 active bool84 // Pause between runs85 interval time.Duration86 // proxy server to use for all HTTP requests87 proxy string88 // username to access the web interface89 accessUsername string90 // password to access the web interface91 accessPassword string92 // results of the last call to UpdateValidation93 validationResult *ValidationResult94}95func NewConfiguration() *Configuration {96 return &Configuration{97 active: true,98 interval: time.Minute,99 timeout: 5 * time.Second,100 }101}102// Credentials returns the door2doc credentials stored in the configuration.103func (c *Configuration) Credentials() (string, string) {104 c.mu.RLock()105 defer c.mu.RUnlock()106 return c.username, c.password107}108func (c *Configuration) SetCredentials(username, password string) {109 c.mu.Lock()110 defer c.mu.Unlock()111 c.username = username112 c.password = password113 dlog.SetUsername(username)114}115func (c *Configuration) Proxy() string {116 c.mu.Lock()117 defer c.mu.Unlock()118 return c.proxy119}120func (c *Configuration) SetProxy(proxy string) {121 c.mu.Lock()122 defer c.mu.Unlock()123 c.proxy = proxy124}125// Connection returns the connection data stored in the configuration.126func (c *Configuration) Connection() db.ConnectionData {127 c.mu.RLock()128 defer c.mu.RUnlock()129 return c.connection130}131func (c *Configuration) SetConnection(cd db.ConnectionData) {132 c.mu.Lock()133 defer c.mu.Unlock()134 c.connection = cd135}136func (c *Configuration) SetDSN(driver, dsn string) {137 c.mu.Lock()138 defer c.mu.Unlock()139 _ = c.connection.UnmarshalText([]byte(dsn))140}141// Timeout returns the timeout used for all queries142func (c *Configuration) Timeout() time.Duration {143 c.mu.RLock()144 defer c.mu.RUnlock()145 return c.timeout146}147func (c *Configuration) SetTimeout(timeout time.Duration) {148 c.mu.Lock()149 defer c.mu.Unlock()150 c.timeout = timeout151}152// VisitorQuery returns the visitor query stored in the configuration.153func (c *Configuration) VisitorQuery() string {154 c.mu.RLock()155 defer c.mu.RUnlock()156 return c.visitorQuery157}158func (c *Configuration) SetVisitorQuery(query string) {159 c.mu.Lock()160 defer c.mu.Unlock()161 c.visitorQuery = query162}163// RadiologieQuery returns the radiologie query stored in the configuration.164func (c *Configuration) RadiologieQuery() string {165 c.mu.RLock()166 defer c.mu.RUnlock()167 return c.radiologieQuery168}169func (c *Configuration) SetRadiologieQuery(query string) {170 c.mu.Lock()171 defer c.mu.Unlock()172 c.radiologieQuery = query173}174// LabQuery returns the lab query stored in the configuration.175func (c *Configuration) LabQuery() string {176 c.mu.RLock()177 defer c.mu.RUnlock()178 return c.labQuery179}180func (c *Configuration) SetLabQuery(query string) {181 c.mu.Lock()182 defer c.mu.Unlock()183 c.labQuery = query184}185// ConsultQuery returns the consult query stored in the configuration.186func (c *Configuration) ConsultQuery() string {187 c.mu.RLock()188 defer c.mu.RUnlock()189 return c.consultQuery190}191func (c *Configuration) SetConsultQuery(query string) {192 c.mu.Lock()193 defer c.mu.Unlock()194 c.consultQuery = query195}196func (c *Configuration) AccessCredentials() (username, password string) {197 c.mu.RLock()198 defer c.mu.RUnlock()199 return c.accessUsername, c.accessPassword200}201func (c *Configuration) SetAccessCredentials(username, password string) {202 c.mu.Lock()203 c.mu.Unlock()204 if username == "" || password == "" {205 username = ""206 password = ""207 }208 c.accessUsername = username209 c.accessPassword = password210}211func (c *Configuration) Active() bool {212 c.mu.RLock()213 defer c.mu.RUnlock()214 return c.active215}216func (c *Configuration) Interval() time.Duration {217 c.mu.RLock()218 defer c.mu.RUnlock()219 return c.interval220}221// UpdateBaseValidation validates the base configuration and returns the results of those checks.222func (c *Configuration) UpdateBaseValidation(ctx context.Context) {223 c.mu.Lock()224 defer c.mu.Unlock()225 res := &ValidationResult{}226 // check d2d connection227 connCtx, timeout := context.WithTimeout(ctx, DBValidationTimeout)228 defer timeout()229 res.D2DConnection, res.D2DCredentials = c.checkConnection(connCtx)230 if c.accessUsername == "" && c.accessPassword == "" {231 res.Access = ErrAccessNotConfigured232 }233 // check timeout234 if c.timeout <= 0 {235 res.QueryTimeout = ErrInvalidTimeout236 }237 // check db connection238 res.VisitorQueryDuration, res.VisitorQueryResults, res.DatabaseConnection, res.VisitorQuery = c.checkDatabase(ctx, c.visitorQuery, func(ctx context.Context, tx *sql.Tx, query string) (QueryResult, error) {239 return db.ExecuteVisitorQuery(ctx, tx, query, c.timeout)240 })241 c.validationResult = res242 c.active = c.validationResult.IsValid()243}244// UpdateRadiologieValidation validates the order configuration and returns the results of those checks.245func (c *Configuration) UpdateRadiologieValidation(ctx context.Context) {246 c.mu.Lock()247 defer c.mu.Unlock()248 if c.validationResult == nil {249 c.validationResult = new(ValidationResult)250 }251 res := c.validationResult252 // check db connection253 res.RadiologieQueryDuration, res.RadiologieQueryResults, res.DatabaseConnection, res.RadiologieQuery = c.checkDatabase(ctx, c.radiologieQuery, func(ctx context.Context, tx *sql.Tx, query string) (QueryResult, error) {254 return db.ExecuteRadiologieQuery(ctx, tx, query, c.timeout)255 })256}257// UpdateLabValidation validates the order configuration and returns the results of those checks.258func (c *Configuration) UpdateLabValidation(ctx context.Context) {259 c.mu.Lock()260 defer c.mu.Unlock()261 if c.validationResult == nil {262 c.validationResult = new(ValidationResult)263 }264 res := c.validationResult265 // check db connection266 res.LabQueryDuration, res.LabQueryResults, res.DatabaseConnection, res.LabQuery = c.checkDatabase(ctx, c.labQuery, func(ctx context.Context, tx *sql.Tx, query string) (QueryResult, error) {267 return db.ExecuteLabQuery(ctx, tx, query, c.timeout)268 })269}270// UpdateConsultValidation validates the order configuration and returns the results of those checks.271func (c *Configuration) UpdateConsultValidation(ctx context.Context) {272 c.mu.Lock()273 defer c.mu.Unlock()274 if c.validationResult == nil {275 c.validationResult = new(ValidationResult)276 }277 res := c.validationResult278 // check db connection279 res.ConsultQueryDuration, res.ConsultQueryResults, res.DatabaseConnection, res.ConsultQuery = c.checkDatabase(ctx, c.consultQuery, func(ctx context.Context, tx *sql.Tx, query string) (QueryResult, error) {280 return db.ExecuteConsultQuery(ctx, tx, query, c.timeout)281 })282}283// Validate returns the result of the last validation.284func (c *Configuration) Validate() *ValidationResult {285 c.mu.RLock()286 defer c.mu.RUnlock()287 return c.validationResult288}289// Reload loads the configuration form a well-known location and updates the values accordingly.290func (c *Configuration) Reload() error {291 folders := configDirs.QueryFolders(configdir.System)292 if len(folders) == 0 {293 return nil294 }295 bs, err := folders[0].ReadFile(config)296 if err != nil {297 if os.IsNotExist(err) {298 return nil299 }300 return err301 }302 if err := json.Unmarshal(bs, &c); err != nil {303 return err304 }305 return nil306}307// Save stores the latest configuration values to a well-known location.308func (c *Configuration) Save() error {309 c.mu.RLock()310 defer c.mu.RUnlock()311 bs, err := json.MarshalIndent(c, "", " ")312 if err != nil {313 return err314 }315 folders := configDirs.QueryFolders(configdir.System)316 if len(folders) == 0 {317 return errors.New("failed to find configuration folder")318 }319 if err := folders[0].WriteFile(config, bs); err != nil {320 return errors.Wrap(err, "while writing configuration file")321 }322 dlog.Info("Updated %s/%s", folders[0].Path, config)323 return nil324}325type persistentConfig struct {326 Username string `json:"username"`327 Password string `json:"password"`328 Proxy string `json:"proxy"`329 Dsn db.ConnectionData `json:"dsn"`330 Timeout int `json:"timeout"`331 VisitorQuery string `json:"query"`332 RadiologieQuery string `json:"radiologie"`333 LabQuery string `json:"lab"`334 ConsultQuery string `json:"consult"`335 AccessUsername string `json:"accessUsername"`336 AccessPassword string `json:"accessPassword"`337}338func (c *Configuration) MarshalJSON() ([]byte, error) {339 c.mu.RLock()340 defer c.mu.RUnlock()341 vars := persistentConfig{342 Username: c.username,343 Password: c.password,344 Proxy: c.proxy,345 Dsn: c.connection,346 VisitorQuery: c.visitorQuery,347 RadiologieQuery: c.radiologieQuery,348 LabQuery: c.labQuery,349 ConsultQuery: c.consultQuery,350 AccessUsername: c.accessUsername,351 AccessPassword: c.accessPassword,352 Timeout: int(c.timeout / time.Second),353 }354 return json.Marshal(vars)355}356func (c *Configuration) UnmarshalJSON(v []byte) error {357 c.mu.Lock()358 defer c.mu.Unlock()359 vars := &persistentConfig{}360 if err := json.Unmarshal(v, &vars); err != nil {361 return err362 }363 if vars.Timeout == 0 {364 vars.Timeout = 5365 }366 c.username = vars.Username367 dlog.SetUsername(c.username)368 c.password = vars.Password369 c.proxy = vars.Proxy370 c.connection = vars.Dsn371 c.visitorQuery = vars.VisitorQuery372 c.radiologieQuery = vars.RadiologieQuery373 c.labQuery = vars.LabQuery374 c.consultQuery = vars.ConsultQuery375 c.accessUsername = vars.AccessUsername376 c.accessPassword = vars.AccessPassword377 c.timeout = time.Duration(vars.Timeout) * time.Second378 return nil379}380func (c *Configuration) checkConnection(ctx context.Context) (connErr error, credErr error) {381 if c.username == "" || c.password == "" {382 credErr = ErrD2DCredentialsNotConfigured383 }384 req, err := http.NewRequest(http.MethodGet, Server, nil)385 if err != nil {386 dlog.Error("Failed to initialize connection to %s: %v", Server, err)387 return err, credErr388 }389 req.URL.Path = PathPing390 req.SetBasicAuth(c.username, c.password)391 res, err := rest.Do(ctx, c.proxy, req)392 if err != nil {393 dlog.Error("Failed to connect to %s: %v", Server, err)394 return ErrD2DConnectionFailed, credErr395 }396 _, err = io.Copy(ioutil.Discard, res.Body)397 if err != nil {398 dlog.Error("Failed to drain response: %v", err)399 return err, credErr400 }401 dlog.Close(res.Body)402 if credErr != nil {403 return nil, credErr404 }405 switch res.StatusCode {406 case http.StatusOK:407 dlog.Info("Ping successful")408 return nil, nil...

Full Screen

Full Screen

Connection

Using AI Code Generation

copy

Full Screen

1import (2type User struct {3}4func main() {5 validate := validator.New()6 user := User{"", "test", 20, "test"}7 err := validate.Struct(user)8 if err != nil {9 fmt.Println(err)10 }11}12import (13type User struct {14}15func main() {16 validate := validator.New()17 user := User{"", "test", 20, "test"}18 err := validate.Struct(user)19 if err != nil {20 err := err.(validator.ValidationErrors)21 for _, e := range err {22 fmt.Println(e)23 }24 }25}26import (27func main() {28 validate := validator.New()29 err := validate.Var(user, "required")30 if err != nil {31 fmt.Println(err)32 }33}34import (

Full Screen

Full Screen

Connection

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 fmt.Println("Hello, playground")4 validation.Connection()5}6import (7func Connection() {8 fmt.Println("Hello, playground")9 db, err := sql.Open("mysql", "root:@/test")10 if err != nil {11 fmt.Println(err)12 }13 defer db.Close()14 fmt.Println("Connection OK")15}16I have used the Connection() method of validation package in 1.go file. When I try to run 1.go file, it gives me error as below:17I have used the Connection() method of validation package in 1.go file. When I try to run 1.go file, it gives me error as below:18In the above error, it says that validation package is undefined. It is not able to recognize the validation package. I am not able to understand why it is not able to recognize the validation package. I have already imported

Full Screen

Full Screen

Connection

Using AI Code Generation

copy

Full Screen

1func connection() {2 var db = validation.Connection()3 var err = db.Ping()4 if err != nil {5 panic(err.Error())6 }7 fmt.Println("Connection Successfull")8}9func connection() {10 var db = validation.Connection()11 var err = db.Ping()12 if err != nil {13 panic(err.Error())14 }15 fmt.Println("Connection Successfull")16}17func connection() {18 var db = validation.Connection()19 var err = db.Ping()20 if err != nil {21 panic(err.Error())22 }23 fmt.Println("Connection Successfull")24}25func connection() {26 var db = validation.Connection()27 var err = db.Ping()28 if err != nil {29 panic(err.Error())30 }31 fmt.Println("Connection Successfull")32}33func connection() {34 var db = validation.Connection()35 var err = db.Ping()36 if err != nil {37 panic(err.Error())38 }39 fmt.Println("Connection Successfull")40}41func connection() {42 var db = validation.Connection()43 var err = db.Ping()44 if err != nil {45 panic(err.Error())46 }47 fmt.Println("Connection Successfull")48}49func connection() {50 var db = validation.Connection()51 var err = db.Ping()52 if err != nil {53 panic(err.Error())54 }55 fmt.Println("Connection Successfull")56}57func connection() {58 var db = validation.Connection()59 var err = db.Ping()60 if err != nil {61 panic(err.Error())62 }63 fmt.Println("Connection Successfull")64}65func connection() {66 var db = validation.Connection()67 var err = db.Ping()68 if err != nil {69 panic(err.Error())70 }

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful