Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/cai2hcl/converters/resource_converters.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ var ConverterMap = map[string]map[string]models.Cai2hclConverter{
"Default": container.NewContainerClusterCai2hclConverter(provider),
},
// ####### END handwritten resources ###########
"aiplatform.googleapis.com/NotebookExecutionJob": {
"Default": colab.NewColabNotebookExecutionCai2hclConverter(provider),
},
"aiplatform.googleapis.com/NotebookRuntime": {
"Default": colab.NewColabRuntimeCai2hclConverter(provider),
},
Expand Down
303 changes: 303 additions & 0 deletions pkg/services/colab/colab_notebook_execution.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
// ----------------------------------------------------------------------------
//
// *** AUTO GENERATED CODE *** Type: MMv1 ***
//
// ----------------------------------------------------------------------------
//
// This code is generated by Magic Modules using the following:
//
// Configuration: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/products/colab/NotebookExecution.yaml
// Template: https://github.com/GoogleCloudPlatform/magic-modules/tree/main/mmv1/templates/tgc_next/services/resource.go.tmpl
//
// DO NOT EDIT this file directly. Any changes made to this file will be
// overwritten during the next generation cycle.
//
// ----------------------------------------------------------------------------

package colab

import (
"bytes"
"context"
"encoding/json"
"fmt"
"log"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

"github.com/GoogleCloudPlatform/terraform-google-conversion/v7/pkg/registry"
"github.com/GoogleCloudPlatform/terraform-google-conversion/v7/pkg/tgcresource"
"github.com/GoogleCloudPlatform/terraform-google-conversion/v7/pkg/tpgresource"
transport_tpg "github.com/GoogleCloudPlatform/terraform-google-conversion/v7/pkg/transport"
"github.com/GoogleCloudPlatform/terraform-google-conversion/v7/pkg/verify"
)

var (
_ = bytes.Clone
_ = context.WithCancel
_ = fmt.Sprintf
_ = json.Unmarshal
_ = log.Print
_ = reflect.ValueOf
_ = regexp.Match
_ = sort.IntSlice{}
_ = strconv.Atoi
_ = strings.Trim
_ = time.Now
_ = schema.Noop
_ = structure.NormalizeJsonString
_ = validation.All
_ = tgcresource.RemoveTerraformAttributionLabel
_ = tpgresource.GetRegion
_ = transport_tpg.Config{}
_ = verify.ProjectRegex
)

func init() {
registry.Schema{
Name: "google_colab_notebook_execution",
ProductName: "colab",
Type: registry.SchemaTypeResource,
Schema: ResourceColabNotebookExecution(),
}.Register()
}

const ColabNotebookExecutionJobAssetType string = "aiplatform.googleapis.com/NotebookExecutionJob"

const ColabNotebookExecutionSchemaName string = "google_colab_notebook_execution"

func ResourceColabNotebookExecution() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"display_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `Required. The display name of the Notebook Execution.`,
},
"gcs_output_uri": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The Cloud Storage location to upload the result to. Format:'gs://bucket-name'`,
},
"location": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The location for the resource: https://cloud.google.com/colab/docs/locations`,
},
"custom_environment_spec": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `Compute configuration to use for an execution job`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"machine_spec": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `'The machine configuration of the runtime.'`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"accelerator_count": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Description: `The number of accelerators used by the runtime.`,
},
"accelerator_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The type of hardware accelerator used by the runtime. If specified, acceleratorCount must also be specified.`,
},
"machine_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The Compute Engine machine type selected for the runtime.`,
},
},
},
},
"network_spec": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `The network configuration for the runtime.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enable_internet_access": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Description: `Enable public internet access for the runtime.`,
},
"network": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths,
Description: `The name of the VPC that this runtime is in.`,
},
"subnetwork": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths,
Description: `The name of the subnetwork that this runtime is in.`,
},
},
},
},
"persistent_disk_spec": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `The configuration for the data disk of the runtime.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"disk_size_gb": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The disk size of the runtime in GB. If specified, the diskType must also be specified. The minimum size is 10GB and the maximum is 65536GB.`,
},
"disk_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The type of the persistent disk.`,
},
},
},
},
},
},
ExactlyOneOf: []string{"custom_environment_spec", "notebook_runtime_template_resource_name"},
},
"dataform_repository_source": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `The Dataform Repository containing the input notebook.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"dataform_repository_resource_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
DiffSuppressFunc: tpgresource.CompareSelfLinkRelativePaths,
Description: `The resource name of the Dataform Repository.`,
},
"commit_sha": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The commit SHA to read repository with. If unset, the file will be read at HEAD.`,
},
},
},
ExactlyOneOf: []string{"dataform_repository_source", "direct_notebook_source", "gcs_notebook_source"},
},
"direct_notebook_source": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `The content of the input notebook in ipynb format.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"content": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The base64-encoded contents of the input notebook file.`,
},
},
},
ExactlyOneOf: []string{"dataform_repository_source", "direct_notebook_source", "gcs_notebook_source"},
},
"execution_timeout": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `Max running time of the execution job in seconds (default 86400s / 24 hrs).`,
},
"execution_user": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The user email to run the execution as.`,
ExactlyOneOf: []string{"execution_user", "service_account"},
},
"gcs_notebook_source": {
Type: schema.TypeList,
Optional: true,
ForceNew: true,
Description: `The Cloud Storage uri for the input notebook.`,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"uri": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The Cloud Storage uri pointing to the ipynb file.`,
},
"generation": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The version of the Cloud Storage object to read. If unset, the current version of the object is read. See https://cloud.google.com/storage/docs/metadata#generation-number.`,
},
},
},
ExactlyOneOf: []string{"dataform_repository_source", "direct_notebook_source", "gcs_notebook_source"},
},
"notebook_execution_job_id": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ForceNew: true,
Description: `User specified ID for the Notebook Execution Job`,
},
"notebook_runtime_template_resource_name": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The NotebookRuntimeTemplate to source compute configuration from.`,
ExactlyOneOf: []string{"custom_environment_spec", "notebook_runtime_template_resource_name"},
},
"service_account": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `The service account to run the execution as.`,
ExactlyOneOf: []string{"execution_user", "service_account"},
},
"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
},
UseJSONNumber: true,
}
}
Loading