Skip to content

Commit 0a24476

Browse files
Support for E3 Flex Notebooks added to datascience
1 parent 98927ec commit 0a24476

10 files changed

+374
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Support charge for Container Images and Generic Artifacts
99
- Support for Generic Artifacts Service
1010
- Support Update `DrgAttachment` of types `Virtual_Circuit`, `RPC` and `IPSec`
11+
- Support for E3 Flex Notebooks added to `datascience`
1112

1213
## 4.27.0 (May 19, 2021)
1314

examples/datascience/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ resource "oci_datascience_notebook_session" "tf_notebook_session" {
7272
subnet_id = oci_core_subnet.tf_subnet.id
7373
#Optional
7474
#block_storage_size_in_gbs = var.notebook_session_notebook_session_configuration_details_block_storage_size_in_gbs
75+
#notebook_session_shape_config_details {
76+
# #Required
77+
# ocpus = var.notebook_session_notebook_session_configuration_details_notebook_session_shape_config_details_opcus
78+
# memory_in_gbs = var.notebook_session_notebook_session_configuration_details_notebook_session_shape_config_details_memory_in_gbs
79+
#}
7580
}
7681

7782
project_id = oci_datascience_project.tf_project.id

oci/datascience_notebook_session_flex_test.go

Lines changed: 271 additions & 0 deletions
Large diffs are not rendered by default.

oci/datascience_notebook_session_resource.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,32 @@ func DatascienceNotebookSessionResource() *schema.Resource {
5757
Optional: true,
5858
Computed: true,
5959
},
60+
"notebook_session_shape_config_details": {
61+
Type: schema.TypeList,
62+
Optional: true,
63+
Computed: true,
64+
MaxItems: 1,
65+
MinItems: 1,
66+
Elem: &schema.Resource{
67+
Schema: map[string]*schema.Schema{
68+
// Required
69+
70+
// Optional
71+
"memory_in_gbs": {
72+
Type: schema.TypeFloat,
73+
Optional: true,
74+
Computed: true,
75+
},
76+
"ocpus": {
77+
Type: schema.TypeFloat,
78+
Optional: true,
79+
Computed: true,
80+
},
81+
82+
// Computed
83+
},
84+
},
85+
},
6086

6187
// Computed
6288
},
@@ -427,6 +453,17 @@ func (s *DatascienceNotebookSessionResourceCrud) mapToNotebookSessionConfigurati
427453
result.BlockStorageSizeInGBs = &tmp
428454
}
429455

456+
if notebookSessionShapeConfigDetails, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "notebook_session_shape_config_details")); ok {
457+
if tmpList := notebookSessionShapeConfigDetails.([]interface{}); len(tmpList) > 0 {
458+
fieldKeyFormatNextLevel := fmt.Sprintf("%s.%d.%%s", fmt.Sprintf(fieldKeyFormat, "notebook_session_shape_config_details"), 0)
459+
tmp, err := s.mapToNotebookSessionShapeConfigDetails(fieldKeyFormatNextLevel)
460+
if err != nil {
461+
return result, fmt.Errorf("unable to convert notebook_session_shape_config_details, encountered error: %v", err)
462+
}
463+
result.NotebookSessionShapeConfigDetails = &tmp
464+
}
465+
}
466+
430467
if shape, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "shape")); ok {
431468
tmp := shape.(string)
432469
result.Shape = &tmp
@@ -447,6 +484,10 @@ func NotebookSessionConfigurationDetailsToMap(obj *oci_datascience.NotebookSessi
447484
result["block_storage_size_in_gbs"] = int(*obj.BlockStorageSizeInGBs)
448485
}
449486

487+
if obj.NotebookSessionShapeConfigDetails != nil {
488+
result["notebook_session_shape_config_details"] = []interface{}{NotebookSessionShapeConfigDetailsToMap(obj.NotebookSessionShapeConfigDetails)}
489+
}
490+
450491
if obj.Shape != nil {
451492
result["shape"] = string(*obj.Shape)
452493
}
@@ -458,6 +499,36 @@ func NotebookSessionConfigurationDetailsToMap(obj *oci_datascience.NotebookSessi
458499
return result
459500
}
460501

502+
func (s *DatascienceNotebookSessionResourceCrud) mapToNotebookSessionShapeConfigDetails(fieldKeyFormat string) (oci_datascience.NotebookSessionShapeConfigDetails, error) {
503+
result := oci_datascience.NotebookSessionShapeConfigDetails{}
504+
505+
if memoryInGBs, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "memory_in_gbs")); ok {
506+
tmp := float32(memoryInGBs.(float64))
507+
result.MemoryInGBs = &tmp
508+
}
509+
510+
if ocpus, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "ocpus")); ok {
511+
tmp := float32(ocpus.(float64))
512+
result.Ocpus = &tmp
513+
}
514+
515+
return result, nil
516+
}
517+
518+
func NotebookSessionShapeConfigDetailsToMap(obj *oci_datascience.NotebookSessionShapeConfigDetails) map[string]interface{} {
519+
result := map[string]interface{}{}
520+
521+
if obj.MemoryInGBs != nil {
522+
result["memory_in_gbs"] = float32(*obj.MemoryInGBs)
523+
}
524+
525+
if obj.Ocpus != nil {
526+
result["ocpus"] = float32(*obj.Ocpus)
527+
}
528+
529+
return result
530+
}
531+
461532
func (s *DatascienceNotebookSessionResourceCrud) updateCompartment(compartment interface{}) error {
462533
changeCompartmentRequest := oci_datascience.ChangeNotebookSessionCompartmentRequest{}
463534

oci/datascience_notebook_session_shape_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ func TestDatascienceNotebookSessionShapeResource_basic(t *testing.T) {
5353
resource.TestCheckResourceAttrSet(datasourceName, "notebook_session_shapes.0.core_count"),
5454
resource.TestCheckResourceAttrSet(datasourceName, "notebook_session_shapes.0.memory_in_gbs"),
5555
resource.TestCheckResourceAttrSet(datasourceName, "notebook_session_shapes.0.name"),
56+
resource.TestCheckResourceAttrSet(datasourceName, "notebook_session_shapes.0.shape_series"),
5657
),
5758
},
5859
},

oci/datascience_notebook_session_shapes_data_source.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ func DatascienceNotebookSessionShapesDataSource() *schema.Resource {
4545
Type: schema.TypeString,
4646
Computed: true,
4747
},
48+
"shape_series": {
49+
Type: schema.TypeString,
50+
Computed: true,
51+
},
4852
},
4953
},
5054
},
@@ -124,6 +128,8 @@ func (s *DatascienceNotebookSessionShapesDataSourceCrud) SetData() error {
124128
notebookSessionShape["name"] = *r.Name
125129
}
126130

131+
notebookSessionShape["shape_series"] = r.ShapeSeries
132+
127133
resources = append(resources, notebookSessionShape)
128134
}
129135

website/docs/d/datascience_notebook_session.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ The following attributes are exported:
4141
* `lifecycle_details` - Details about the state of the notebook session.
4242
* `notebook_session_configuration_details` - Details for the notebook session configuration.
4343
* `block_storage_size_in_gbs` - A notebook session instance is provided with a block storage volume. This specifies the size of the volume in GBs.
44+
* `notebook_session_shape_config_details` - Details for the notebook session shape configuration.
45+
* `memory_in_gbs` - A notebook session instance of type VM.Standard.E3.Flex allows memory to be specified. This specifies the size of the memory in GBs.
46+
* `ocpus` - A notebook session instance of type VM.Standard.E3.Flex allows the ocpu count to be specified.
4447
* `shape` - The shape used to launch the notebook session compute instance. The list of available shapes in a given compartment can be retrieved using the `ListNotebookSessionShapes` endpoint.
4548
* `subnet_id` - A notebook session instance is provided with a VNIC for network access. This specifies the [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet to create a VNIC in. The subnet should be in a VCN with a NAT gateway for egress to the internet.
4649
* `notebook_session_url` - The URL to interact with the notebook session.

website/docs/d/datascience_notebook_session_shapes.html.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,5 @@ The following attributes are exported:
4141
* `core_count` - The number of cores associated with this notebook session shape.
4242
* `memory_in_gbs` - The amount of memory in GBs associated with this notebook session shape.
4343
* `name` - The name of the notebook session shape.
44+
* `shape_series` - The family that the compute shape belongs to.
4445

website/docs/d/datascience_notebook_sessions.html.markdown

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ The following attributes are exported:
5959
* `lifecycle_details` - Details about the state of the notebook session.
6060
* `notebook_session_configuration_details` - Details for the notebook session configuration.
6161
* `block_storage_size_in_gbs` - A notebook session instance is provided with a block storage volume. This specifies the size of the volume in GBs.
62+
* `notebook_session_shape_config_details` - Details for the notebook session shape configuration.
63+
* `memory_in_gbs` - A notebook session instance of type VM.Standard.E3.Flex allows memory to be specified. This specifies the size of the memory in GBs.
64+
* `ocpus` - A notebook session instance of type VM.Standard.E3.Flex allows the ocpu count to be specified.
6265
* `shape` - The shape used to launch the notebook session compute instance. The list of available shapes in a given compartment can be retrieved using the `ListNotebookSessionShapes` endpoint.
6366
* `subnet_id` - A notebook session instance is provided with a VNIC for network access. This specifies the [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet to create a VNIC in. The subnet should be in a VCN with a NAT gateway for egress to the internet.
6467
* `notebook_session_url` - The URL to interact with the notebook session.

website/docs/r/datascience_notebook_session.html.markdown

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ resource "oci_datascience_notebook_session" "test_notebook_session" {
2525
2626
#Optional
2727
block_storage_size_in_gbs = var.notebook_session_notebook_session_configuration_details_block_storage_size_in_gbs
28+
notebook_session_shape_config_details {
29+
30+
#Optional
31+
memory_in_gbs = var.notebook_session_notebook_session_configuration_details_notebook_session_shape_config_details_memory_in_gbs
32+
ocpus = var.notebook_session_notebook_session_configuration_details_notebook_session_shape_config_details_ocpus
33+
}
2834
}
2935
project_id = oci_datascience_project.test_project.id
3036
@@ -45,6 +51,9 @@ The following arguments are supported:
4551
* `freeform_tags` - (Optional) (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. See [Resource Tags](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: `{"Department": "Finance"}`
4652
* `notebook_session_configuration_details` - (Required) (Updatable) Details for the notebook session configuration.
4753
* `block_storage_size_in_gbs` - (Optional) (Updatable) A notebook session instance is provided with a block storage volume. This specifies the size of the volume in GBs.
54+
* `notebook_session_shape_config_details` - (Optional) (Updatable) Details for the notebook session shape configuration.
55+
* `memory_in_gbs` - (Optional) (Updatable) A notebook session instance of type VM.Standard.E3.Flex allows memory to be specified. This specifies the size of the memory in GBs.
56+
* `ocpus` - (Optional) (Updatable) A notebook session instance of type VM.Standard.E3.Flex allows the ocpu count to be specified.
4857
* `shape` - (Required) (Updatable) The shape used to launch the notebook session compute instance. The list of available shapes in a given compartment can be retrieved using the `ListNotebookSessionShapes` endpoint.
4958
* `subnet_id` - (Required) (Updatable) A notebook session instance is provided with a VNIC for network access. This specifies the [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet to create a VNIC in. The subnet should be in a VCN with a NAT gateway for egress to the internet.
5059
* `project_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the project to associate with the notebook session.
@@ -66,6 +75,9 @@ The following attributes are exported:
6675
* `lifecycle_details` - Details about the state of the notebook session.
6776
* `notebook_session_configuration_details` - Details for the notebook session configuration.
6877
* `block_storage_size_in_gbs` - A notebook session instance is provided with a block storage volume. This specifies the size of the volume in GBs.
78+
* `notebook_session_shape_config_details` - Details for the notebook session shape configuration.
79+
* `memory_in_gbs` - A notebook session instance of type VM.Standard.E3.Flex allows memory to be specified. This specifies the size of the memory in GBs.
80+
* `ocpus` - A notebook session instance of type VM.Standard.E3.Flex allows the ocpu count to be specified.
6981
* `shape` - The shape used to launch the notebook session compute instance. The list of available shapes in a given compartment can be retrieved using the `ListNotebookSessionShapes` endpoint.
7082
* `subnet_id` - A notebook session instance is provided with a VNIC for network access. This specifies the [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the subnet to create a VNIC in. The subnet should be in a VCN with a NAT gateway for egress to the internet.
7183
* `notebook_session_url` - The URL to interact with the notebook session.

0 commit comments

Comments
 (0)